diff options
author | Joas Schilling <coding@schilljs.com> | 2019-09-09 18:29:35 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-09-09 18:29:35 +0300 |
commit | e40518fdc27117b989e2e474fb52b59ede15e551 (patch) | |
tree | ccbc9f98b603f0b73b35d2e50240294e2fb353bb /lib/Activity | |
parent | 822384b24bb8600956cc23f57543f5a9b9f92ec4 (diff) |
Also create call summary for calls with only guests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Activity')
-rw-r--r-- | lib/Activity/Listener.php | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php index 32deaef52..581f90eb5 100644 --- a/lib/Activity/Listener.php +++ b/lib/Activity/Listener.php @@ -114,8 +114,8 @@ class Listener { $duration = $this->timeFactory->getTime() - $activeSince->getTimestamp(); $userIds = $room->getParticipantUserIds($activeSince); - if (empty($userIds) || (\count($userIds) === 1 && $room->getActiveGuests() === 0)) { - // Single user pinged or guests only => no activity + if ((\count($userIds) + $room->getActiveGuests()) === 1) { + // Single user pinged or guests only => no summary/activity $room->resetActiveSince(); return false; } @@ -127,6 +127,21 @@ class Listener { return false; } + $actorId = $userIds[0] ?? 'guests-only'; + $actorType = $actorId !== 'guests-only' ? 'users' : 'guests'; + $this->chatManager->addSystemMessage($room, $actorType, $actorId, json_encode([ + 'message' => 'call_ended', + 'parameters' => [ + 'users' => $userIds, + 'guests' => $numGuests, + 'duration' => $duration, + ], + ]), $this->timeFactory->getDateTime(), false); + + if (empty($userIds)) { + return false; + } + $event = $this->activityManager->generateEvent(); try { $event->setApp('spreed') @@ -145,15 +160,6 @@ class Listener { return false; } - $this->chatManager->addSystemMessage($room, 'users', $userIds[0], json_encode([ - 'message' => 'call_ended', - 'parameters' => [ - 'users' => $userIds, - 'guests' => $numGuests, - 'duration' => $duration, - ], - ]), $this->timeFactory->getDateTime(), false); - foreach ($userIds as $userId) { try { $event->setAffectedUser($userId); |