Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make whatsapp icon clickable and hide private attachments in edit history #9768

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libraries/kunena/src/User/KunenaUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ public function socialButtons()
'telegram' => ['url' => 'https://t.me/##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_TELEGRAM'), 'nourl' => '0'],
'apple' => ['url' => '##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_APPLE'), 'nourl' => '1'],
'vimeo' => ['url' => 'https://vimeo.com/user##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_VIMEO'), 'nourl' => '1'],
'whatsapp' => ['url' => '##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_WHATSAPP'), 'nourl' => '1'],
'whatsapp' => ['url' => 'https://wa.me/##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_WHATSAPP'), 'nourl' => '0'],
'youtube' => ['url' => 'https://www.youtube-nocookie.com/##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_YOUTUBE'), 'nourl' => '0'],
'ok' => ['url' => 'https://ok.ru/##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_OK'), 'nourl' => '0'],
'pinterest' => ['url' => 'https://pinterest.com/##VALUE##', 'title' => Text::_('COM_KUNENA_MYPROFILE_PINTEREST'), 'nourl' => '0'],
Expand Down
63 changes: 36 additions & 27 deletions src/site/template/aurelia/layouts/topic/edit/history/default.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Kunena Component
*
Expand All @@ -10,16 +9,12 @@
* @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
Loading