From 51b0b65d9b20102487686b1c04aeee9ab11776c3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 11 Dec 2024 08:33:15 +0100 Subject: [PATCH] fix(call): Fix call notification when being pinged again after leaving a call Signed-off-by: Joas Schilling --- lib/Service/ParticipantService.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index c4f4e4648ad..891f2243f83 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -1653,6 +1653,18 @@ public function checkIfUserIsMissingCall(string $token, string $userId): int { if ($activeSince->getTimestamp() >= $row['last_joined_call']) { return CallNotificationController::CASE_STILL_CURRENT; } + + // The participant had joined the call, but left again. + // In this case we should not ring any more, but clients stop + // pinging the endpoint 45s after receiving the push anyway. + // However, it is also possible that the participant was ringed + // again by a moderator after they had joined the call before. + // So if a client pings the endpoint after 45s initial ringing + // + 15 seconds for worst case push notification delay, we will + // again tell them to show the call notification. + if (($activeSince->getTimestamp() + 45 + 15) < $this->timeFactory->getTime()) { + return CallNotificationController::CASE_STILL_CURRENT; + } return CallNotificationController::CASE_PARTICIPANT_JOINED; }