Skip to content

Commit

Permalink
Made changes based on the comments given by Joas
Browse files Browse the repository at this point in the history
  • Loading branch information
Purva92Gupta committed Mar 26, 2024
1 parent fc2d96a commit c694d41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
17 changes: 0 additions & 17 deletions lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1947,21 +1947,4 @@ public function getParticipantByActor(Room $room, string $actorType, string $act
$this->cacheParticipant($room, $participant);
return $participant;
}

/**
* @param int $mentionId
* @return string
*/
public function getLastUnreadMentionMessage(int $mentionId)
{
$query = $this->connection->getQueryBuilder();
$query->select('c.message')
->from('comments', 'c')
->where('c.id = :mentionId')
->setParameter('mentionId', $mentionId)
->setMaxResults(1);

$result = $query->executeQuery();
return $result->fetchOne();
}
}
3 changes: 2 additions & 1 deletion lib/Service/RoomFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function formatRoomV4(
$lastMentionDirect = $attendee->getLastMentionDirect();
$roomData['unreadMention'] = $lastMention !== 0 && $lastReadMessage < $lastMention;
$roomData['unreadMentionDirect'] = $lastMentionDirect !== 0 && $lastReadMessage < $lastMentionDirect;
$roomData['lastUnreadMentionMessage'] = ($lastMentionDirect !== 0 or $lastMentionDirect !== null) ? $this->participantService->getLastUnreadMentionMessage($lastMentionDirect) : '';
$roomData['lastUnreadMentionMessage'] = $lastMentionDirect ? $this->chatManager->getComment($room, (string)$lastMentionDirect)->getMessage() : '';
$roomData['lastReadMessage'] = $lastReadMessage;

$roomData['canDeleteConversation'] = $room->getType() !== Room::TYPE_ONE_TO_ONE
Expand All @@ -342,6 +342,7 @@ public function formatRoomV4(
$roomData['unreadMessages'] = $this->chatManager->getUnreadCount($room, $lastReadMessage);
$roomData['unreadMention'] = $lastMention !== 0 && $lastReadMessage < $lastMention;
$roomData['unreadMentionDirect'] = $lastMentionDirect !== 0 && $lastReadMessage < $lastMentionDirect;
$roomData['lastUnreadMentionMessage'] = $lastMentionDirect ? $this->chatManager->getComment($room, (string)$lastMentionDirect)->getMessage() : '';
} else {
$roomData['lastReadMessage'] = $attendee->getLastReadMessage();
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default {
}

if (conversation.unreadMentionDirect) {
return t('spreed', conversation.lastUnreadMentionMessage)
return conversation.lastUnreadMentionMessage
}

return this.simpleLastChatMessage(conversation.lastMessage)
Expand Down

0 comments on commit c694d41

Please sign in to comment.