diff --git a/lib/Chat/Notifier.php b/lib/Chat/Notifier.php index 653efb57205..a48f199aed7 100644 --- a/lib/Chat/Notifier.php +++ b/lib/Chat/Notifier.php @@ -76,9 +76,8 @@ public function notifyMentionedUsers(Room $chat, IComment $comment, array $alrea $shouldFlush = $this->notificationManager->defer(); } - foreach ($usersToNotify as $mentionedUser) { - if ($this->shouldMentionedUserBeNotified($mentionedUser['id'], $comment, $chat, $mentionedUser['attendee'] ?? null)) { + if ($this->shouldMentionedUserBeNotified($mentionedUser['id'], $comment, $chat, $mentionedUser['attendee'] ?? null, $mentionedUser['reason'])) { if (!$silent) { $notification->setUser($mentionedUser['id']); if (isset($mentionedUser['reason'])) { @@ -210,7 +209,7 @@ public function notifyReplyToAuthor(Room $chat, IComment $comment, IComment $rep ]; } - if (!$this->shouldMentionedUserBeNotified($replyTo->getActorId(), $comment, $chat)) { + if (!$this->shouldMentionedUserBeNotified($replyTo->getActorId(), $comment, $chat, null, 'reply')) { return []; } @@ -565,14 +564,8 @@ protected function getDefaultGroupNotification(): int { * 2. The user must exist * 3. The user must be a participant of the room * 4. The user must not be active in the room - * - * @param string $userId - * @param IComment $comment - * @param Room $room - * @param Attendee|null $attendee - * @return bool */ - protected function shouldMentionedUserBeNotified(string $userId, IComment $comment, Room $room, ?Attendee $attendee = null): bool { + protected function shouldMentionedUserBeNotified(string $userId, IComment $comment, Room $room, ?Attendee $attendee, string $reason): bool { if ($comment->getActorType() === Attendee::ACTOR_USERS && $userId === $comment->getActorId()) { // Do not notify the user if they mentioned themselves return false; @@ -590,6 +583,10 @@ protected function shouldMentionedUserBeNotified(string $userId, IComment $comme $participant = new Participant($room, $attendee, null); } + if ($reason === 'all' && $attendee->isArchived()) { + return false; + } + if ($room->getLobbyState() !== Webinary::LOBBY_NONE && !($participant->getPermissions() & Attendee::PERMISSIONS_LOBBY_IGNORE)) { return false; diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 71ba2e4f0c5..16e9db52ad4 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -1753,6 +1753,7 @@ public function getParticipantUserIdsForCallNotifications(Room $room): array { ->where($query->expr()->eq('a.room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))) ->andWhere($query->expr()->eq('a.actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS))) ->andWhere($query->expr()->eq('a.notification_calls', $query->createNamedParameter(Participant::NOTIFY_CALLS_ON))) + ->andWhere($query->expr()->eq('a.archived', $query->createNamedParameter(false, IQueryBuilder::PARAM_BOOL))) ->andWhere($query->expr()->isNull('s.in_call')); if ($room->getLobbyState() !== Webinary::LOBBY_NONE) {