diff options
author | Joas Schilling <coding@schilljs.com> | 2021-09-01 18:28:19 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-09-20 13:51:19 +0300 |
commit | bf6150be9549813459f26a92cfafaa114331cebe (patch) | |
tree | 68ec559bba93f0198cfc79fdb19111ab435f268d /lib/Service | |
parent | 9aff2302dfc1f94c607e0296ca14a620c2758cdb (diff) |
Add a counter for the direct mentions
This allows the UI can show the user bubble depending on user vs. all mentions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/ParticipantService.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 03d7f927a..16d29f2cf 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -870,7 +870,7 @@ class ParticipantService { $this->dispatcher->dispatch(Room::EVENT_AFTER_SESSION_UPDATE_CALL_FLAGS, $event); } - public function markUsersAsMentioned(Room $room, array $userIds, int $messageId): void { + public function markUsersAsMentioned(Room $room, array $userIds, int $messageId, array $usersDirectlyMentioned): void { $query = $this->connection->getQueryBuilder(); $query->update('talk_attendees') ->set('last_mention_message', $query->createNamedParameter($messageId, IQueryBuilder::PARAM_INT)) @@ -878,6 +878,16 @@ class ParticipantService { ->andWhere($query->expr()->eq('actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS))) ->andWhere($query->expr()->in('actor_id', $query->createNamedParameter($userIds, IQueryBuilder::PARAM_STR_ARRAY))); $query->execute(); + + if (!empty($usersDirectlyMentioned)) { + $query = $this->connection->getQueryBuilder(); + $query->update('talk_attendees') + ->set('last_mention_direct', $query->createNamedParameter($messageId, IQueryBuilder::PARAM_INT)) + ->where($query->expr()->eq('room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))) + ->andWhere($query->expr()->eq('actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS))) + ->andWhere($query->expr()->in('actor_id', $query->createNamedParameter($usersDirectlyMentioned, IQueryBuilder::PARAM_STR_ARRAY))); + $query->execute(); + } } public function resetChatDetails(Room $room): void { @@ -885,6 +895,7 @@ class ParticipantService { $query->update('talk_attendees') ->set('last_read_message', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) ->set('last_mention_message', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) + ->set('last_mention_direct', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) ->where($query->expr()->eq('room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))); $query->executeStatement(); } |