diff options
author | Joas Schilling <coding@schilljs.com> | 2019-02-26 12:46:30 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-02-26 12:46:30 +0300 |
commit | 0f0a9baaae23655aa3ac3a86972b82665f83087c (patch) | |
tree | 3629fd2c4753447c8006b28ef155fc3b785953af /lib/Activity | |
parent | 5489820cd34a4f25cb12fc16f189d8c7f2ce547a (diff) |
Fix duplicated call summary message when multiple people leave at the same time
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Activity')
-rw-r--r-- | lib/Activity/Listener.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php index 290bb885d..05dfad2eb 100644 --- a/lib/Activity/Listener.php +++ b/lib/Activity/Listener.php @@ -120,6 +120,13 @@ class Listener { return false; } + $numGuests = $room->getActiveGuests(); + + if (!$room->resetActiveSince()) { + // Race-condition, the room was already reset. + return false; + } + $event = $this->activityManager->generateEvent(); try { $event->setApp('spreed') @@ -130,7 +137,7 @@ class Listener { ->setSubject('call', [ 'room' => $room->getId(), 'users' => $userIds, - 'guests' => $room->getActiveGuests(), + 'guests' => $numGuests, 'duration' => $duration, ]); } catch (\InvalidArgumentException $e) { @@ -142,7 +149,7 @@ class Listener { 'message' => 'call_ended', 'parameters' => [ 'users' => $userIds, - 'guests' => $room->getActiveGuests(), + 'guests' => $numGuests, 'duration' => $duration, ], ]), $this->timeFactory->getDateTime(), false); @@ -158,7 +165,6 @@ class Listener { } } - $room->resetActiveSince(); return true; } |