diff options
author | Joas Schilling <coding@schilljs.com> | 2022-05-24 23:59:39 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-05-25 09:50:53 +0300 |
commit | b7b319c470b5322d13b8152b89a701d75f6200c4 (patch) | |
tree | 1cccef5674cb868e1d4319b7102dc966cd3d4cf5 /lib/Chat | |
parent | 7e3b71f07a9915355d9770eb97135f4dc26c05ab (diff) |
Fix "Invalid argument supplied for foreach() at SystemMessage.php#720"
This can happen if a user gets deleted from a one-to-one conversation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Chat')
-rw-r--r-- | lib/Chat/Parser/SystemMessage.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index e8165712a..68a794406 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -716,6 +716,21 @@ class SystemMessage { ]; } + if ($room->getType() !== Room::TYPE_ONE_TO_ONE) { + // Can happen if a user was remove from a one-to-one room. + return [ + $this->l->t('You tried to call {user}'), + [ + 'user' => [ + 'type' => 'highlight', + 'id' => 'deleted_user', + 'name' => $room->getName(), + ], + ], + 'call_tried', + ]; + } + $participants = json_decode($room->getName(), true); $other = ''; foreach ($participants as $participant) { @@ -723,6 +738,7 @@ class SystemMessage { $other = $participant; } } + return [ $this->l->t('You tried to call {user}'), [ |