Skip to content
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
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
-----------------------
- Enh #68: Make "subject" optional
- Fix #485: Compatibility with HumHub 1.18.1
- Fix #487: Encode user name

3.3.8 (January 15, 2026)
-----------------------
Expand Down
10 changes: 5 additions & 5 deletions models/MessageNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace humhub\modules\mail\models;

use humhub\helpers\Html;
use humhub\modules\content\widgets\richtext\converter\RichTextToEmailHtmlConverter;
use humhub\modules\content\widgets\richtext\converter\RichTextToHtmlConverter;
use humhub\modules\mail\helpers\Url;
Expand All @@ -14,7 +15,6 @@
use humhub\modules\user\models\User;
use Yii;
use yii\base\BaseObject;
use yii\helpers\Html;

class MessageNotification extends BaseObject
{
Expand Down Expand Up @@ -190,7 +190,7 @@ protected function getContent(User $user)
if ($this->entry->type === AbstractMessageEntry::TYPE_USER_JOINED) {
return $this->entry->user->is($user)
? Yii::t('MailModule.base', 'You joined the conversation.')
: Yii::t('MailModule.base', '{username} joined the conversation.', ['username' => $this->entry->user->displayName]);
: Yii::t('MailModule.base', '{username} joined the conversation.', ['username' => Html::encode($this->entry->user->displayName)]);
}

return RichTextToEmailHtmlConverter::process($this->entry->content, [
Expand Down Expand Up @@ -247,14 +247,14 @@ protected function getEntrySender()

protected function getSubject(User $user): string
{
$params = ['{senderName}' => $this->getEntrySender()->displayName];

if ($this->entry->type === AbstractMessageEntry::TYPE_USER_JOINED) {
return $this->entry->user->is($user)
? Yii::t('MailModule.base', 'You joined the conversation.')
: Yii::t('MailModule.base', '{username} joined the conversation.', ['username' => $this->entry->user->displayName]);
: Yii::t('MailModule.base', '{username} joined the conversation.', ['username' => Html::encode($this->entry->user->displayName)]);
}

$params = ['{senderName}' => Html::encode($this->getEntrySender()->displayName)];

return $this->isNewConversation
? Yii::t('MailModule.base', 'New conversation from {senderName}', $params)
: Yii::t('MailModule.base', 'New message from {senderName}', $params);
Expand Down
4 changes: 2 additions & 2 deletions widgets/InboxMessagePreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ public function getMessagePreview(): string
case AbstractMessageEntry::TYPE_USER_JOINED:
return $this->isOwnLastEntry()
? Yii::t('MailModule.base', 'You joined the conversation.')
: Yii::t('MailModule.base', '{username} joined the conversation.', ['username' => $this->getUsername()]);
: Yii::t('MailModule.base', '{username} joined the conversation.', ['username' => Html::encode($this->getUsername())]);

case AbstractMessageEntry::TYPE_USER_LEFT:
return $this->isOwnLastEntry()
? Yii::t('MailModule.base', 'You left the conversation.')
: Yii::t('MailModule.base', '{username} left the conversation.', ['username' => $this->getUsername()]);
: Yii::t('MailModule.base', '{username} left the conversation.', ['username' => Html::encode($this->getUsername())]);
}

if ($this->isGroupChat()) {
Expand Down
4 changes: 3 additions & 1 deletion widgets/ParticipantUserList.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public function run()
return '';
}

return Link::asLink($userList)->action('ui.modal.load', Url::toConversationUserList($this->message));
return Link::asLink($userList)
->action('ui.modal.load', Url::toConversationUserList($this->message))
->encodeLabel(false);
}

private function renderUserList(): string
Expand Down