Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-05-27 10:57:40 +0300
committerGitHub <noreply@github.com>2022-05-27 10:57:40 +0300
commit66407b03556c28f63c101fdfef734037444f09f5 (patch)
tree63b193f9d287de89061ad734acfaef1aba291f99
parent0b1840d71a50a19edfb11329a1cd4e24f2f6cff2 (diff)
parent73272f3289488580a444d2beb0fff1d93437e878 (diff)
Merge pull request #7421 from nextcloud/backport/7420/stable22
[stable22] Fix "Invalid argument supplied for foreach() at SystemMessage.php#720"
-rw-r--r--lib/Chat/Parser/SystemMessage.php16
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php27
2 files changed, 37 insertions, 6 deletions
diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php
index c1fb2d0bc..ebdc43d25 100644
--- a/lib/Chat/Parser/SystemMessage.php
+++ b/lib/Chat/Parser/SystemMessage.php
@@ -646,6 +646,21 @@ class SystemMessage {
];
}
+ if ($room->getType() !== Room::ONE_TO_ONE_CALL) {
+ // 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) {
@@ -653,6 +668,7 @@ class SystemMessage {
$other = $participant;
}
}
+
return [
$this->l->t('You tried to call {user}'),
[
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 16160049c..524f90d1f 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -1508,16 +1508,31 @@ class FeatureContext implements Context, SnippetAcceptingContext {
return;
}
- Assert::assertCount(count($formData->getHash()), $messages, 'Message count does not match');
- Assert::assertEquals($formData->getHash(), array_map(function ($message) {
- return [
+ $expected = $formData->getHash();
+
+ Assert::assertCount(count($expected), $messages, 'Message count does not match');
+ Assert::assertEquals($expected, array_map(function ($message, $expected) {
+ $data = [
'room' => self::$tokenToIdentifier[$message['token']],
'actorType' => (string) $message['actorType'],
- 'actorId' => ($message['actorType'] === 'guests')? self::$sessionIdToUser[$message['actorId']]: (string) $message['actorId'],
- 'actorDisplayName' => (string) $message['actorDisplayName'],
+ 'actorId' => ($message['actorType'] === 'guests') ? self::$sessionIdToUser[$message['actorId']]: (string) $message['actorId'],
'systemMessage' => (string) $message['systemMessage'],
];
- }, $messages));
+
+ if (isset($expected['actorDisplayName'])) {
+ $data['actorDisplayName'] = $message['actorDisplayName'];
+ }
+
+ if (isset($expected['message'])) {
+ $data['message'] = $message['message'];
+ }
+
+ if (isset($expected['messageParameters'])) {
+ $data['messageParameters'] = json_encode($message['messageParameters']);
+ }
+
+ return $data;
+ }, $messages, $expected));
}
/**