diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-10-25 13:22:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 13:22:08 +0300 |
commit | 351c3090c073a7208c830447ac7807bf916d2718 (patch) | |
tree | 7a74b1948080a349968ad8adfa77908a99d76bdf /lib/Service | |
parent | 00269d075ef38cc25d0cfca5364854264a0332b3 (diff) | |
parent | 730a18416b3db0c86ebe8daff0a90eaef651d278 (diff) |
Merge pull request #6338 from nextcloud/feature/noid/allow-to-opt-out-of-call-notifications
Allow to opt out of call notifications
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/ParticipantService.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 260658e6b..1d83fd3c2 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -221,6 +221,23 @@ class ParticipantService { } /** + * @param Participant $participant + * @param int $level + */ + public function updateNotificationCalls(Participant $participant, int $level): void { + if (!\in_array($level, [ + Participant::NOTIFY_CALLS_OFF, + Participant::NOTIFY_CALLS_ON, + ], true)) { + throw new \InvalidArgumentException('Invalid notification level'); + } + + $attendee = $participant->getAttendee(); + $attendee->setNotificationCalls($level); + $this->attendeeMapper->update($attendee); + } + + /** * @param Room $room * @param IUser $user * @param string $password @@ -1218,7 +1235,7 @@ class ParticipantService { * @param Room $room * @return string[] */ - public function getParticipantUserIdsNotInCall(Room $room): array { + public function getParticipantUserIdsForCallNotifications(Room $room): array { $query = $this->connection->getQueryBuilder(); $query->select('a.actor_id') @@ -1233,6 +1250,7 @@ class ParticipantService { ) ->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()->isNull('s.in_call')); $userIds = []; |