Skip to content

Commit 179ab48

Browse files
committed
fix: throw error when target has DND on 2
Signed-off-by: skalidindi53 <[email protected]>
1 parent 53a331c commit 179ab48

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/Service/ParticipantService.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
use OCP\IUserManager;
7272
use OCP\Security\ISecureRandom;
7373
use OCP\Server;
74+
use OCP\UserStatus\IManager as IUserStatusManager;
75+
use OCP\UserStatus\IUserStatus;
7476

7577
class ParticipantService {
7678

@@ -95,6 +97,7 @@ public function __construct(
9597
private BackendNotifier $backendNotifier,
9698
private ITimeFactory $timeFactory,
9799
private ICacheFactory $cacheFactory,
100+
private IUserStatusManager $userStatusManager,
98101
) {
99102
}
100103

@@ -1181,9 +1184,9 @@ public function sendCallNotificationForAttendee(Room $room, Participant $current
11811184
throw new DoesNotExistException('Room mismatch');
11821185
}
11831186

1184-
$userStatus = $this->userManager->getUserStatus(array ($attendee->getActorId()));
1185-
if ($userStatus[0] === IUser::DND){
1186-
throw new \InvalidArgumentException('User is in do not disturb mode, failed to send notification');
1187+
$userStatus = $this->userStatusManager->getUserStatuses([$attendee->getActorId()]);
1188+
if (isset($userStatus[0]) && $userStatus[0]->getStatus() === IUserStatus::DND) {
1189+
throw new \InvalidArgumentException('status');
11871190
}
11881191

11891192
$sessions = $this->sessionMapper->findByAttendeeId($targetAttendeeId);

0 commit comments

Comments
 (0)