Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(polls): Remove actor info from system message
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed May 13, 2024
commit 342eca0e018f46f282a505e7cdbeb5ffb626d4b6
2 changes: 2 additions & 0 deletions lib/Chat/Parser/SystemMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ protected function parseMessage(Message $chatMessage): void {
$parsedParameters['poll']['id'] = (string) $parsedParameters['poll']['id'];
$parsedMessage = $this->l->t('Someone voted on the poll {poll}');
unset($parsedParameters['actor']);

$chatMessage->setActor(Attendee::ACTOR_GUESTS, Attendee::ACTOR_ID_SYSTEM, '');
} else {
throw new \OutOfBoundsException('Unknown subject');
}
Expand Down
14 changes: 13 additions & 1 deletion tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2679,7 +2679,16 @@ public function userSeesTheFollowingSystemMessagesInRoom($user, $identifier, $st
return;
}

$expected = $formData->getHash();
$expected = array_map(static function (array $message) {
if (isset($message['messageParameters'])) {
$result = preg_match('/POLL_ID\(([^)]+)\)/', $message['messageParameters'], $matches);
if ($result) {
$message['messageParameters'] = str_replace($matches[0], '"' . self::$questionToPollId[$matches[1]] . '"', $message['messageParameters']);
}
}
return $message;
}, $formData->getHash());


Assert::assertCount(count($expected), $messages, 'Message count does not match');
Assert::assertEquals($expected, array_map(function ($message, $expected) {
Expand All @@ -2700,6 +2709,9 @@ public function userSeesTheFollowingSystemMessagesInRoom($user, $identifier, $st

if (isset($expected['messageParameters'])) {
$data['messageParameters'] = json_encode($message['messageParameters']);
if ($expected['messageParameters'] === '"IGNORE"') {
$data['messageParameters'] = '"IGNORE"';
}
}

return $data;
Expand Down
Loading