Skip to content

Commit

Permalink
Added checks for expired/deleted message
Browse files Browse the repository at this point in the history
Also added parsing of mention message correctly
  • Loading branch information
Purva92Gupta committed Mar 27, 2024
1 parent 4aa4dd0 commit 68d6f14
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Dashboard/TalkWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,15 @@ protected function prepareRoom(Room $room, string $userId): WidgetItem {
$subtitle = '';

$lastMessage = $room->getLastMessage();

$lastMentionDirect = $participant->getAttendee()->getLastMentionDirect();
$lastReadMessage = $participant->getAttendee()->getLastReadMessage();
if ($lastMentionDirect > $lastReadMessage) {
$lastMessage = $this->chatManager->getComment($room, (string)$lastMentionDirect);
}

if ($lastMessage instanceof IComment) {
$message = $this->messageParser->createMessage($room, $participant, $room->getLastMessage(), $this->l10n);
$message = $this->messageParser->createMessage($room, $participant, $lastMessage, $this->l10n);
$this->messageParser->parseMessage($message);

$now = $this->timeFactory->getDateTime();
Expand All @@ -202,8 +209,6 @@ protected function prepareRoom(Room $room, string $userId): WidgetItem {

if ($room->getCallFlag() !== Participant::FLAG_DISCONNECTED) {
$subtitle = $this->l10n->t('Call in progress');
} elseif ($participant->getAttendee()->getLastMentionDirect() > $participant->getAttendee()->getLastReadMessage()) {
$subtitle = $this->chatManager->getComment($room, (string)$participant->getAttendee()->getLastMentionDirect())->getMessage();
}

return new WidgetItem(
Expand Down

0 comments on commit 68d6f14

Please sign in to comment.