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 @@ -4,6 +4,7 @@ Changelog
3.3.13 (Unreleased)
----------------------
- Fix #512: Validate `from` pagination cursor to prevent unbounded conversation loading
- Fix #514: Optimize pin icon rendering on the inbox message list

3.3.12 (July 16, 2026)
----------------------
Expand Down
10 changes: 8 additions & 2 deletions models/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,15 @@ public function isPinned($userId = null): bool
return $userMessage && $userMessage->pinned;
}

public function getPinIcon($userId = null): ?Icon
/**
* @param int|null $userId
* @param bool|null $isPinned pass the already known pinned state (e.g. from a
* preloaded UserMessage) to avoid an extra lookup via {@see isPinned()}
* @return Icon|null
*/
public function getPinIcon($userId = null, ?bool $isPinned = null): ?Icon
{
if ($this->isPinned($userId)) {
if ($isPinned ?? $this->isPinned($userId)) {
return Icon::get('map-pin')
->tooltip(Yii::t('MailModule.base', 'Pinned'))
->color('var(--bs-danger)');
Expand Down
1 change: 1 addition & 0 deletions widgets/InboxMessagePreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function run()
'messageText' => $this->getMessagePreview(),
'messageTime' => $this->getMessageTime(),
'lastParticipant' => $this->lastParticipant(),
'isPinned' => $this->userMessage->pinned,
'options' => $this->getOptions(),
]);
}
Expand Down
3 changes: 2 additions & 1 deletion widgets/views/inboxMessagePreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/* @var $messageText string */
/* @var $messageTime string */
/* @var $lastParticipant User */
/* @var $isPinned bool */
/* @var $options array */
?>
<?= Html::beginTag('div', $options) ?>
Expand All @@ -31,7 +32,7 @@
</div>
<div class="text-break flex-grow-1">
<h4 class="mt-0">
<?= Html::encode($messageTitle) . ' ' . $message->getPinIcon() ?>
<?= Html::encode($messageTitle) . ' ' . $message->getPinIcon(isPinned: $isPinned) ?>
<time><?= $messageTime ?></time>
</h4>
<span class="new-message-badge"></span>
Expand Down
Loading