From 342eca0e018f46f282a505e7cdbeb5ffb626d4b6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 10 May 2024 16:06:37 +0200 Subject: [PATCH 1/3] fix(polls): Remove actor info from system message Signed-off-by: Joas Schilling --- lib/Chat/Parser/SystemMessage.php | 2 + .../features/bootstrap/FeatureContext.php | 14 ++- .../integration/features/chat-2/poll.feature | 86 +++++++++++++++++-- 3 files changed, 94 insertions(+), 8 deletions(-) diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 7c3c607dcf3..debaa02115d 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -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'); } diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 74c7b31d9e2..2487dd83785 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -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) { @@ -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; diff --git a/tests/integration/features/chat-2/poll.feature b/tests/integration/features/chat-2/poll.feature index 7389cd5686f..e17749048b3 100644 --- a/tests/integration/features/chat-2/poll.feature +++ b/tests/integration/features/chat-2/poll.feature @@ -96,6 +96,12 @@ Feature: chat-2/poll | status | closed | | votedSelf | not voted | | details | [{"actorType":"users","actorId":"participant1","actorDisplayName":"participant1-displayname","optionId":1}] | + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can update their votes but only while open Given user "participant1" creates room "room" (v4) @@ -147,6 +153,12 @@ Feature: chat-2/poll | votedSelf | [1] | | details | [{"actorType":"users","actorId":"participant1","actorDisplayName":"participant1-displayname","optionId":1}] | Then user "participant1" votes for options "[0]" on poll "What is the question?" in room "room" with 400 + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can only vote for valid options Given user "participant1" creates room "room" (v4) @@ -159,6 +171,9 @@ Feature: chat-2/poll | maxVotes | unlimited | Then user "participant1" votes for options "[-1]" on poll "What is the question?" in room "room" with 400 Then user "participant1" votes for options "[2]" on poll "What is the question?" in room "room" with 400 + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can not exceed the maxVotes Given user "participant1" creates room "room" (v4) @@ -170,6 +185,9 @@ Feature: chat-2/poll | resultMode | public | | maxVotes | 1 | Then user "participant1" votes for options "[0,1]" on poll "What is the question?" in room "room" with 400 + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can vote for multiple options Given user "participant1" creates room "room" (v4) @@ -193,6 +211,10 @@ Feature: chat-2/poll | actorDisplayName | participant1-displayname | | status | open | | votedSelf | [0,1] | + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can not vote for the same option multiple times Given user "participant1" creates room "room" (v4) @@ -204,6 +226,9 @@ Feature: chat-2/poll | resultMode | public | | maxVotes | unlimited | Then user "participant1" votes for options "[1,1]" on poll "What is the question?" in room "room" with 400 + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Non-moderators can also create polls and close it themselves Given user "participant1" creates room "room" (v4) @@ -232,6 +257,11 @@ Feature: chat-2/poll | status | closed | | votedSelf | not voted | | details | {} | + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant2 | poll_closed | {actor} ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Non-moderators can not create polls without chat permission Given user "participant1" creates room "room" (v4) @@ -270,6 +300,11 @@ Feature: chat-2/poll | status | closed | | votedSelf | not voted | | details | {} | + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: There are system messages for opening, voting and closing on public polls Given user "participant1" creates room "room" (v4) @@ -322,17 +357,16 @@ Feature: chat-2/poll | votedSelf | [0] | | details | [{"actorType":"users","actorId":"participant1","actorDisplayName":"participant1-displayname","optionId":0},{"actorType":"users","actorId":"participant2","actorDisplayName":"participant2-displayname","optionId":1}] | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | actorDisplayName | systemMessage | - | room | users | participant1 | participant1-displayname | poll_closed | - | room | users | participant2 | participant2-displayname | poll_voted | - | room | users | participant1 | participant1-displayname | poll_voted | - | room | users | participant1 | participant1-displayname | user_added | - | room | users | participant1 | participant1-displayname | conversation_created | + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Then user "participant1" sees the following messages in room "room" with 200 (v1) | room | actorType | actorId | actorDisplayName | message | messageParameters | | room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - Scenario: There are only system messages for opening and closing on hidden polls Given user "participant1" creates room "room" (v4) | roomType | 2 | @@ -469,6 +503,11 @@ Feature: chat-2/poll | actorDisplayName | participant1-displayname | | status | closed | | votedSelf | not voted | + Then user "participant1" sees the following system messages in room "room" with 200 + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Number of voters and votes are restricted to the very same poll Given user "participant1" creates room "room" (v4) @@ -524,6 +563,12 @@ Feature: chat-2/poll | actorDisplayName | participant2-displayname | | status | open | | votedSelf | [1] | + Then user "participant1" sees the following system messages in room "room" with 200 + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(Another one ...),"name":"Another one ..."}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Remove all votes Given user "participant1" creates room "room" (v4) @@ -574,6 +619,12 @@ Feature: chat-2/poll | actorDisplayName | participant1-displayname | | status | open | | votedSelf | [] | + Then user "participant1" sees the following system messages in room "room" with 200 + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Empty question and options Given user "participant1" creates room "room" (v4) @@ -652,6 +703,13 @@ Feature: chat-2/poll | status | closed | | votedSelf | [] | | details | [{"actorType":"deleted_users","actorId":"deleted_users","actorDisplayName":"","optionId":0}] | + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | admin | user_removed | {actor} removed {user} | !ISSET | "IGNORE" | + | room | deleted_users | deleted_users | poll_closed | {actor} ended the poll {poll} | !ISSET | {"actor":{"type":"highlight","id":"deleted_users","name":"Deleted user"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"highlight","id":"deleted_users","name":"Deleted user"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Deleting the poll message removes all details Given user "participant1" creates room "room" (v4) @@ -676,6 +734,11 @@ Feature: chat-2/poll And user "participant1" sees the following messages in room "room" with 200 (v1) | room | actorType | actorId | actorDisplayName | message | messageParameters | | room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" | + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Deleting a closed poll message removes also the close message Given user "participant1" creates room "room" (v4) @@ -715,6 +778,12 @@ Feature: chat-2/poll | room | actorType | actorId | actorDisplayName | message | messageParameters | | room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" | | room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" | + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Deleting the chat history also deletes polls Given user "participant1" creates room "room" (v4) @@ -733,3 +802,6 @@ Feature: chat-2/poll Then user "participant1" sees poll "What is the question?" in room "room" with 404 Then user "participant2" sees poll "What is the question?" in room "room" with 404 And user "participant1" sees the following messages in room "room" with 200 (v1) + Then user "participant1" sees the following system messages in room "room" with 200 (v1) + | room | actorType | actorId | systemMessage | message | silent | messageParameters | + | room | users | participant1 | history_cleared | You cleared the history of the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | From 22d06cb374cce0220688e89027eaa0ffe30a9d9e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 13 May 2024 16:23:02 +0200 Subject: [PATCH 2/3] fix(tests): Remove silent flag from tests Signed-off-by: Joas Schilling --- .../integration/features/chat-2/poll.feature | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/tests/integration/features/chat-2/poll.feature b/tests/integration/features/chat-2/poll.feature index e17749048b3..7cbd3094edb 100644 --- a/tests/integration/features/chat-2/poll.feature +++ b/tests/integration/features/chat-2/poll.feature @@ -97,11 +97,11 @@ Feature: chat-2/poll | votedSelf | not voted | | details | [{"actorType":"users","actorId":"participant1","actorDisplayName":"participant1-displayname","optionId":1}] | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can update their votes but only while open Given user "participant1" creates room "room" (v4) @@ -154,11 +154,11 @@ Feature: chat-2/poll | details | [{"actorType":"users","actorId":"participant1","actorDisplayName":"participant1-displayname","optionId":1}] | Then user "participant1" votes for options "[0]" on poll "What is the question?" in room "room" with 400 Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can only vote for valid options Given user "participant1" creates room "room" (v4) @@ -172,8 +172,8 @@ Feature: chat-2/poll Then user "participant1" votes for options "[-1]" on poll "What is the question?" in room "room" with 400 Then user "participant1" votes for options "[2]" on poll "What is the question?" in room "room" with 400 Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can not exceed the maxVotes Given user "participant1" creates room "room" (v4) @@ -186,8 +186,8 @@ Feature: chat-2/poll | maxVotes | 1 | Then user "participant1" votes for options "[0,1]" on poll "What is the question?" in room "room" with 400 Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can vote for multiple options Given user "participant1" creates room "room" (v4) @@ -212,9 +212,9 @@ Feature: chat-2/poll | status | open | | votedSelf | [0,1] | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Participants can not vote for the same option multiple times Given user "participant1" creates room "room" (v4) @@ -227,8 +227,8 @@ Feature: chat-2/poll | maxVotes | unlimited | Then user "participant1" votes for options "[1,1]" on poll "What is the question?" in room "room" with 400 Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Non-moderators can also create polls and close it themselves Given user "participant1" creates room "room" (v4) @@ -258,10 +258,10 @@ Feature: chat-2/poll | votedSelf | not voted | | details | {} | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant2 | poll_closed | {actor} ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant2 | poll_closed | {actor} ended the poll {poll} | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Non-moderators can not create polls without chat permission Given user "participant1" creates room "room" (v4) @@ -301,10 +301,10 @@ Feature: chat-2/poll | votedSelf | not voted | | details | {} | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: There are system messages for opening, voting and closing on public polls Given user "participant1" creates room "room" (v4) @@ -357,12 +357,12 @@ Feature: chat-2/poll | votedSelf | [0] | | details | [{"actorType":"users","actorId":"participant1","actorDisplayName":"participant1-displayname","optionId":0},{"actorType":"users","actorId":"participant2","actorDisplayName":"participant2-displayname","optionId":1}] | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Then user "participant1" sees the following messages in room "room" with 200 (v1) | room | actorType | actorId | actorDisplayName | message | messageParameters | | room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | @@ -504,10 +504,10 @@ Feature: chat-2/poll | status | closed | | votedSelf | not voted | Then user "participant1" sees the following system messages in room "room" with 200 - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | poll_closed | You ended the poll {poll} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Number of voters and votes are restricted to the very same poll Given user "participant1" creates room "room" (v4) @@ -564,11 +564,11 @@ Feature: chat-2/poll | status | open | | votedSelf | [1] | Then user "participant1" sees the following system messages in room "room" with 200 - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(Another one ...),"name":"Another one ..."}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(Another one ...),"name":"Another one ..."}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Remove all votes Given user "participant1" creates room "room" (v4) @@ -620,11 +620,11 @@ Feature: chat-2/poll | status | open | | votedSelf | [] | Then user "participant1" sees the following system messages in room "room" with 200 - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Empty question and options Given user "participant1" creates room "room" (v4) @@ -704,12 +704,12 @@ Feature: chat-2/poll | votedSelf | [] | | details | [{"actorType":"deleted_users","actorId":"deleted_users","actorDisplayName":"","optionId":0}] | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | admin | user_removed | {actor} removed {user} | !ISSET | "IGNORE" | - | room | deleted_users | deleted_users | poll_closed | {actor} ended the poll {poll} | !ISSET | {"actor":{"type":"highlight","id":"deleted_users","name":"Deleted user"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | guests | system | poll_voted | Someone voted on the poll {poll} | !ISSET | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"highlight","id":"deleted_users","name":"Deleted user"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | admin | user_removed | {actor} removed {user} | "IGNORE" | + | room | deleted_users | deleted_users | poll_closed | {actor} ended the poll {poll} | {"actor":{"type":"highlight","id":"deleted_users","name":"Deleted user"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"highlight","id":"deleted_users","name":"Deleted user"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Deleting the poll message removes all details Given user "participant1" creates room "room" (v4) @@ -735,10 +735,10 @@ Feature: chat-2/poll | room | actorType | actorId | actorDisplayName | message | messageParameters | | room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | message_deleted | You deleted a message | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Deleting a closed poll message removes also the close message Given user "participant1" creates room "room" (v4) @@ -779,11 +779,11 @@ Feature: chat-2/poll | room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" | | room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" | Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | - | room | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | - | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | message_deleted | You deleted a message | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | message_deleted | You deleted a message | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Deleting the chat history also deletes polls Given user "participant1" creates room "room" (v4) @@ -803,5 +803,5 @@ Feature: chat-2/poll Then user "participant2" sees poll "What is the question?" in room "room" with 404 And user "participant1" sees the following messages in room "room" with 200 (v1) Then user "participant1" sees the following system messages in room "room" with 200 (v1) - | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | history_cleared | You cleared the history of the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | actorType | actorId | systemMessage | message | messageParameters | + | room | users | participant1 | history_cleared | You cleared the history of the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | From 45ed6193242f66389a5c8485a407b7a197a2945f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 13 May 2024 18:39:03 +0200 Subject: [PATCH 3/3] fix(tests): Adjust fake actor id Signed-off-by: Joas Schilling --- tests/integration/features/chat-2/poll.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/features/chat-2/poll.feature b/tests/integration/features/chat-2/poll.feature index 7cbd3094edb..e59e2a977c0 100644 --- a/tests/integration/features/chat-2/poll.feature +++ b/tests/integration/features/chat-2/poll.feature @@ -706,9 +706,9 @@ Feature: chat-2/poll Then user "participant1" sees the following system messages in room "room" with 200 (v1) | room | actorType | actorId | systemMessage | message | messageParameters | | room | users | admin | user_removed | {actor} removed {user} | "IGNORE" | - | room | deleted_users | deleted_users | poll_closed | {actor} ended the poll {poll} | {"actor":{"type":"highlight","id":"deleted_users","name":"Deleted user"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | deleted_users | deleted_users | poll_closed | {actor} ended the poll {poll} | {"actor":{"type":"highlight","id":"deleted_user","name":"Deleted user"},"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | | room | guests | system | poll_voted | Someone voted on the poll {poll} | {"poll":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | - | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"highlight","id":"deleted_users","name":"Deleted user"}} | + | room | users | participant1 | user_added | You added {user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"highlight","id":"deleted_user","name":"Deleted user"}} | | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | Scenario: Deleting the poll message removes all details