Skip to content

Commit

Permalink
Update history - default.php
Browse files Browse the repository at this point in the history
Hide private attachments when other user replies
  • Loading branch information
Pinkeltje authored Nov 15, 2024
1 parent 0a9909a commit f1c7006
Showing 1 changed file with 37 additions and 28 deletions.
65 changes: 37 additions & 28 deletions src/site/template/aurelia/layouts/topic/edit/history/default.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
<?php

/**
* Kunena Component
*
* @package Kunena.Template.Aurelia
* @subpackage Topic
*
* @copyright Copyright (C) 2008 - @currentyear@ Kunena Team. All rights reserved.
* @copyright Copyright (C) 2008 - 2024 Kunena Team. All rights reserved.
* @license https://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
**/

namespace Kunena\Forum\Site;

\defined('_JEXEC') or die();

use Joomla\CMS\Language\Text;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Html\KunenaParser;
use Kunena\Forum\Libraries\Icons\KunenaIcons;

?>
<div class="float-end">
<div class="btn btn-outline-primary border btn-small" data-bs-toggle="collapse" data-bs-target="#history">X</div>
Expand All @@ -28,14 +23,11 @@
<?php echo Text::_('COM_KUNENA_POST_TOPIC_HISTORY') ?>:
<?php echo $this->escape($this->topic->subject) ?>
</h3>

<div id="history" class="collapse show">
<p>
<?php echo Text::_('COM_KUNENA_POST_TOPIC_HISTORY_MAX') . ' ' . $this->escape($this->config->historyLimit) . ' ' . Text::_('COM_KUNENA_POST_TOPIC_HISTORY_LAST') ?>
</p>
<?php foreach ($this->history as $this->message) :
?>

<?php foreach ($this->history as $this->message) : ?>
<div class="row">
<div class="col-md-2 center">
<ul class="unstyled center profilebox">
Expand All @@ -46,7 +38,6 @@
<?php
$profile = KunenaFactory::getUser(\intval($this->message->userid));
$useravatar = $profile->getAvatarImage(KunenaFactory::getTemplate()->params->get('avatarType'), 'profile');

if ($useravatar) :
echo $this->message->getAuthor()->getLink($useravatar, null, '', '', null, $this->topic->getcategory()->id);
endif;
Expand All @@ -65,24 +56,42 @@
</div>
<?php
$attachments = $this->message->getAttachments();
$hasVisibleAttachments = false;

// Filter out private attachments
$visibleAttachments = array_filter($attachments, function($attachment) {
return $attachment->protected != 32; // Exclude private attachments
});

if (!empty($visibleAttachments)) :
foreach ($visibleAttachments as $attachment) {
if (!$attachment->inline) {
$hasVisibleAttachments = true;
break;
}
}
endif;

if (!empty($attachments)) :
?>
<div class="card pb-3 pd-3 mb-3">

<div class="card-body kattach">
<ul class="thumbnails">
<?php foreach ($attachments as $attachment) :
?>
<li class="col-md-3 text-center">
<div class="thumbnail">
<?php echo $attachment->getLayout()->render('thumbnail'); ?>
<?php echo $attachment->getLayout()->render('textlink'); ?>
</div>
</li>
<?php endforeach; ?>
</ul>
</div></div>
if ($hasVisibleAttachments) : ?>
<div class="card pb-3 pd-3 mb-3">
<div class="card-header">
<?php echo Text::_('COM_KUNENA_ATTACHMENTS'); ?>
</div>
<div class="card-body kattach">
<ul class="thumbnails">
<?php foreach ($visibleAttachments as $attachment) :
if (!$attachment->inline) : ?>
<li class="col-md-3 text-center">
<div class="thumbnail">
<?php echo $attachment->getLayout()->render('thumbnail'); ?>
<?php echo $attachment->getLayout()->render('textlink'); ?>
</div>
</li>
<?php endif;
endforeach; ?>
</ul>
</div>
</div>
<?php endif; ?>
</div>
</div>
Expand Down

0 comments on commit f1c7006

Please sign in to comment.