From b26a78401a35a41c2bc385601a0a29540dbc83bd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 31 Jan 2025 17:14:39 +0100 Subject: [PATCH 1/4] feat(chat): Add the mention id to parameters for easier editing Signed-off-by: Joas Schilling --- lib/Chat/Parser/SystemMessage.php | 4 + lib/Chat/Parser/UserMention.php | 7 +- lib/Federation/Proxy/TalkV1/UserConverter.php | 21 +++++ .../features/callapi/notifications.feature | 12 +-- .../features/chat-1/delete.feature | 32 ++++---- .../features/chat-1/edit-message.feature | 8 +- .../features/chat-1/file-share.feature | 2 +- .../features/chat-1/note-to-self.feature | 2 +- .../integration/features/chat-2/poll.feature | 78 +++++++++---------- .../features/chat-2/reaction.feature | 2 +- .../features/chat-2/rich-messages.feature | 10 +-- .../features/chat-2/rich-object-share.feature | 8 +- .../features/command/user-remove.feature | 8 +- .../features/conversation-1/avatar.feature | 2 +- .../features/federation/invite.feature | 26 +++---- .../features/sharing-1/delete.feature | 2 +- tests/php/Chat/Parser/SystemMessageTest.php | 2 + tests/php/Chat/Parser/UserMentionTest.php | 32 +++++--- 18 files changed, 152 insertions(+), 106 deletions(-) diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 440fc900f50..2fe37600c48 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -911,6 +911,7 @@ protected function getUser(string $uid): array { 'type' => 'user', 'id' => $uid, 'name' => $this->displayNames[$uid], + 'mention-id' => $uid, ]; } @@ -928,6 +929,7 @@ protected function getRemoteUser(Room $room, string $federationId): array { 'id' => $cloudId->getUser(), 'name' => $displayName, 'server' => $cloudId->getRemote(), + 'mention-id' => 'federated_user/' . $cloudId->getUser() . '@' . $cloudId->getRemote(), ]; } @@ -949,6 +951,7 @@ protected function getGroup(string $gid): array { 'type' => 'group', 'id' => $gid, 'name' => $this->groupNames[$gid], + 'mention-id' => 'user-group/' . $gid, ]; } @@ -1029,6 +1032,7 @@ protected function getGuest(Room $room, string $actorType, string $actorId): arr 'type' => 'guest', 'id' => 'guest/' . $actorId, 'name' => $this->guestNames[$key], + 'mention-id' => ($actorType === Attendee::ACTOR_GUESTS ? 'guest/' : 'email/') . $actorId, ]; } diff --git a/lib/Chat/Parser/UserMention.php b/lib/Chat/Parser/UserMention.php index 1b241088ea9..e390260bde7 100644 --- a/lib/Chat/Parser/UserMention.php +++ b/lib/Chat/Parser/UserMention.php @@ -165,6 +165,7 @@ protected function parseMessage(Message $chatMessage): void { 'name' => $chatMessage->getRoom()->getDisplayName($userId, true), 'call-type' => $this->getRoomType($chatMessage->getRoom()), 'icon-url' => $this->avatarService->getAvatarUrl($chatMessage->getRoom()), + 'mention-id' => $search, ]; } elseif ($mention['type'] === 'guest') { try { @@ -178,6 +179,7 @@ protected function parseMessage(Message $chatMessage): void { 'type' => $mention['type'], 'id' => $mention['id'], 'name' => $displayName, + 'mention-id' => $search, ]; } elseif ($mention['type'] === 'federated_user') { try { @@ -197,7 +199,8 @@ protected function parseMessage(Message $chatMessage): void { 'type' => 'user', 'id' => $cloudId->getUser(), 'name' => $displayName, - 'server' => $cloudId->getRemote() + 'server' => $cloudId->getRemote(), + 'mention-id' => $search, ]; } elseif ($mention['type'] === 'group') { $group = $this->groupManager->get($mention['id']); @@ -211,6 +214,7 @@ protected function parseMessage(Message $chatMessage): void { 'type' => 'user-group', 'id' => $mention['id'], 'name' => $displayName, + 'mention-id' => $search, ]; } else { try { @@ -225,6 +229,7 @@ protected function parseMessage(Message $chatMessage): void { 'type' => $mention['type'], 'id' => $mention['id'], 'name' => $displayName, + 'mention-id' => $search, ]; } } diff --git a/lib/Federation/Proxy/TalkV1/UserConverter.php b/lib/Federation/Proxy/TalkV1/UserConverter.php index 576f848e284..fad753ab2dc 100644 --- a/lib/Federation/Proxy/TalkV1/UserConverter.php +++ b/lib/Federation/Proxy/TalkV1/UserConverter.php @@ -101,9 +101,15 @@ protected function convertMessageParameter(Room $room, array $parameter): array if ($parameter['type'] === 'user') { // RichObjectDefinition, not Attendee::ACTOR_USERS if (!isset($parameter['server'])) { $parameter['server'] = $room->getRemoteServer(); + if (!isset($parameter['mention-id'])) { + $parameter['mention-id'] = $parameter['id']; + } } elseif ($parameter['server']) { $localParticipants = $this->getLocalParticipants($room); $cloudId = $this->createCloudIdFromUserIdAndFullServerUrl($parameter['id'], $parameter['server']); + if (!isset($parameter['mention-id'])) { + $parameter['mention-id'] = 'federated_user/' . $parameter['id'] . '@' . $parameter['server']; + } if (isset($localParticipants[$cloudId])) { unset($parameter['server']); $parameter['name'] = $localParticipants[$cloudId]['displayName']; @@ -112,6 +118,21 @@ protected function convertMessageParameter(Room $room, array $parameter): array } elseif ($parameter['type'] === 'call' && $parameter['id'] === $room->getRemoteToken()) { $parameter['id'] = $room->getToken(); $parameter['icon-url'] = $this->avatarService->getAvatarUrl($room); + if (!isset($parameter['mention-id'])) { + $parameter['mention-id'] = 'all'; + } + } elseif ($parameter['type'] === 'circle') { + if (!isset($parameter['mention-id'])) { + $parameter['mention-id'] = 'team/' . $parameter['id']; + } + } elseif ($parameter['type'] === 'user-group') { + if (!isset($parameter['mention-id'])) { + $parameter['mention-id'] = 'group/' . $parameter['id']; + } + } elseif ($parameter['type'] === 'email' || $parameter['type'] === 'guest') { + if (!isset($parameter['mention-id'])) { + $parameter['mention-id'] = $parameter['type'] . '/' . $parameter['id']; + } } return $parameter; } diff --git a/tests/integration/features/callapi/notifications.feature b/tests/integration/features/callapi/notifications.feature index 27bb24069bc..f804ad22f32 100644 --- a/tests/integration/features/callapi/notifications.feature +++ b/tests/integration/features/callapi/notifications.feature @@ -29,9 +29,9 @@ Feature: callapi/notifications Given user "participant1" joins call "room" with 200 (v4) Then user "participant2" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | call_started | {actor} started a call | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | - | room | users | participant1 | user_added | {actor} added you | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | {actor} created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | call_started | {actor} started a call | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | + | room | users | participant1 | user_added | {actor} added you | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | {actor} created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Then user "participant2" has the following notifications | app | object_type | object_id | subject | | spreed | call | room | A group call has started in room | @@ -51,9 +51,9 @@ Feature: callapi/notifications | silent | true | Then user "participant2" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | silent | messageParameters | - | room | users | participant1 | call_started | {actor} started a silent call | true | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | - | room | users | participant1 | user_added | {actor} added you | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"user":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room | users | participant1 | conversation_created | {actor} created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | call_started | {actor} started a silent call | true | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | + | room | users | participant1 | user_added | {actor} added you | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | {actor} created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Then user "participant2" has the following notifications | app | object_type | object_id | subject | Given user "participant1" leaves call "room" with 200 (v4) diff --git a/tests/integration/features/chat-1/delete.feature b/tests/integration/features/chat-1/delete.feature index ed8a53e4875..f10bc0fcfab 100644 --- a/tests/integration/features/chat-1/delete.feature +++ b/tests/integration/features/chat-1/delete.feature @@ -18,10 +18,10 @@ Feature: chat/delete And user "participant1" deletes message "Message 1" from room "group room" with 200 Then user "participant1" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | group room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant2" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | group room | users | participant1 | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant1 | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant1" received a system messages in room "group room" to delete "Message 1" Then user "participant2" received a system messages in room "group room" to delete "Message 1" @@ -40,10 +40,10 @@ Feature: chat/delete And user "participant2" deletes message "Message 1" from room "group room" with 200 Then user "participant1" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | group room | users | participant2 | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | | Then user "participant2" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | | Then user "participant1" received a system messages in room "group room" to delete "Message 1" Then user "participant2" received a system messages in room "group room" to delete "Message 1" @@ -75,10 +75,10 @@ Feature: chat/delete And user "participant1" deletes message "Message 1" from room "group room" with 200 Then user "participant1" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant2" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | group room | users | participant2 | participant2-displayname | Message deleted by {actor} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by {actor} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant1" received a system messages in room "group room" to delete "Message 1" Then user "participant2" received a system messages in room "group room" to delete "Message 1" @@ -101,11 +101,11 @@ Feature: chat/delete Then user "participant1" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | | group room | users | participant1 | participant1-displayname | Message 1-1 | [] | Message deleted by you | - | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant2" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | | group room | users | participant1 | participant1-displayname | Message 1-1 | [] | Message deleted by {actor} | - | group room | users | participant2 | participant2-displayname | Message deleted by {actor} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by {actor} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant1" received a system messages in room "group room" to delete "Message 1" Then user "participant2" received a system messages in room "group room" to delete "Message 1" @@ -128,11 +128,11 @@ Feature: chat/delete Then user "participant1" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | | group room | users | participant1 | participant1-displayname | Message 1-1 | [] | Message deleted by author | - | group room | users | participant2 | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | | Then user "participant2" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | | group room | users | participant1 | participant1-displayname | Message 1-1 | [] | Message deleted by you | - | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | | Then user "participant1" received a system messages in room "group room" to delete "Message 1" Then user "participant2" received a system messages in room "group room" to delete "Message 1" @@ -155,11 +155,11 @@ Feature: chat/delete Then user "participant1" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | | group room | users | participant1 | participant1-displayname | Message 1-1 | [] | Message deleted by you | - | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant2" sees the following messages in room "group room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | | group room | users | participant1 | participant1-displayname | Message 1-1 | [] | Message deleted by {actor} | - | group room | users | participant2 | participant2-displayname | Message deleted by {actor} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | group room | users | participant2 | participant2-displayname | Message deleted by {actor} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Then user "participant1" received a system messages in room "group room" to delete "Message 1" Then user "participant2" received a system messages in room "group room" to delete "Message 1" @@ -187,12 +187,12 @@ Feature: chat/delete And user "participant2" deletes message "Message 2" from room "room1" with 200 Then user "participant1" sees the following messages in room "room1" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room1 | users | participant2 | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room1 | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room1 | users | participant2 | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room1 | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Then user "participant2" sees the following messages in room "room1" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room1 | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | - | room1 | users | participant1 | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room1 | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room1 | users | participant1 | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Clear chat history as a moderator Given user "participant1" creates room "room1" (v4) diff --git a/tests/integration/features/chat-1/edit-message.feature b/tests/integration/features/chat-1/edit-message.feature index c6a1a79556d..30da38a510b 100644 --- a/tests/integration/features/chat-1/edit-message.feature +++ b/tests/integration/features/chat-1/edit-message.feature @@ -100,7 +100,7 @@ Feature: chat-1/edit-message And user "participant2" edits message "Message 1" in room "room" to "Message 1 - Edit @participant1" with 200 Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room | users | participant2 | participant2-displayname | Message 1 - Edit {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant2 | participant2-displayname | Message 1 - Edit {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Then user "participant1" has the following notifications | app | object_type | object_id | subject | | spreed | chat | room/Message 1 - Edit {mention-user1} | participant2-displayname mentioned you in conversation room | @@ -160,7 +160,7 @@ Feature: chat-1/edit-message And user "participant2" sends message "Message 1 - @participant1" to room "room" with 201 Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room | users | participant2 | participant2-displayname | Message 1 - {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant2 | participant2-displayname | Message 1 - {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Then user "participant1" has the following notifications | app | object_type | object_id | subject | | spreed | chat | room/Message 1 - {mention-user1} | participant2-displayname mentioned you in conversation room | @@ -180,7 +180,7 @@ Feature: chat-1/edit-message And user "participant2" edits message "Message 1 - @participant1" in room "room" to "Message 1 - Edit @participant1" with 200 Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room | users | participant2 | participant2-displayname | Message 1 - Edit {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant2 | participant2-displayname | Message 1 - Edit {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Then user "participant1" has the following notifications | app | object_type | object_id | subject | | spreed | chat | room/Message 1 - Edit {mention-user1} | participant2-displayname mentioned you in conversation room | @@ -209,7 +209,7 @@ Feature: chat-1/edit-message And user "participant2" edits message "Message 1 - @all" in room "room" to "Message 1 - Edit @participant1" with 200 Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room | users | participant2 | participant2-displayname | Message 1 - Edit {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant2 | participant2-displayname | Message 1 - Edit {mention-user1} | {"mention-user1":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Then user "participant1" has the following notifications | app | object_type | object_id | subject | | spreed | chat | room/Message 1 - Edit {mention-user1} | participant2-displayname mentioned everyone in conversation room | diff --git a/tests/integration/features/chat-1/file-share.feature b/tests/integration/features/chat-1/file-share.feature index 0b8b01d001e..2a9abcfeec7 100644 --- a/tests/integration/features/chat-1/file-share.feature +++ b/tests/integration/features/chat-1/file-share.feature @@ -104,7 +104,7 @@ Feature: chat/file-share And user "participant1" deletes message "shared::file::welcome.txt" from room "public room" with 200 Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | public room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Can not delete a share file message without chat permission Given user "participant1" creates room "public room" (v4) diff --git a/tests/integration/features/chat-1/note-to-self.feature b/tests/integration/features/chat-1/note-to-self.feature index 3e44131ff03..029ee86f9cd 100644 --- a/tests/integration/features/chat-1/note-to-self.feature +++ b/tests/integration/features/chat-1/note-to-self.feature @@ -11,7 +11,7 @@ Feature: chat/note-to-self | participant1-note-to-self | 6 | Note to self | Then user "participant1" sees the following system messages in room "participant1-note-to-self" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | systemMessage | - | participant1-note-to-self | users | participant1 | participant1-displayname | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | conversation_created | + | participant1-note-to-self | users | participant1 | participant1-displayname | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | conversation_created | Scenario: Created automatically when fetching the room list diff --git a/tests/integration/features/chat-2/poll.feature b/tests/integration/features/chat-2/poll.feature index e17749048b3..f056cd9c3d4 100644 --- a/tests/integration/features/chat-2/poll.feature +++ b/tests/integration/features/chat-2/poll.feature @@ -15,7 +15,7 @@ Feature: chat-2/poll | maxVotes | unlimited | Then user "participant1" sees the following messages in room "room" with 200 | 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?"}} | + | room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | Then user "participant1" sees poll "What is the question?" in room "room" with 200 | id | POLL_ID(What is the question?) | | question | What is the question? | @@ -98,10 +98,10 @@ Feature: chat-2/poll | 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 | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"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 | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Participants can update their votes but only while open Given user "participant1" creates room "room" (v4) @@ -155,10 +155,10 @@ Feature: chat-2/poll 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 | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"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 | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Participants can only vote for valid options Given user "participant1" creates room "room" (v4) @@ -173,7 +173,7 @@ Feature: chat-2/poll 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 | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Participants can not exceed the maxVotes Given user "participant1" creates room "room" (v4) @@ -187,7 +187,7 @@ Feature: chat-2/poll 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 | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Participants can vote for multiple options Given user "participant1" creates room "room" (v4) @@ -214,7 +214,7 @@ Feature: chat-2/poll 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 | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Participants can not vote for the same option multiple times Given user "participant1" creates room "room" (v4) @@ -228,7 +228,7 @@ Feature: chat-2/poll 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 | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Non-moderators can also create polls and close it themselves Given user "participant1" creates room "room" (v4) @@ -242,7 +242,7 @@ Feature: chat-2/poll | maxVotes | unlimited | Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room | users | participant2 | participant2-displayname | {object} | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | users | participant2 | participant2-displayname | {object} | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | Then user "participant2" closes poll "What is the question?" in room "room" with 200 | id | POLL_ID(What is the question?) | | question | What is the question? | @@ -259,9 +259,9 @@ Feature: chat-2/poll | 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 | users | participant2 | poll_closed | {actor} ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"},"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","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Non-moderators can not create polls without chat permission Given user "participant1" creates room "room" (v4) @@ -302,9 +302,9 @@ Feature: chat-2/poll | 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 | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"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","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: There are system messages for opening, voting and closing on public polls Given user "participant1" creates room "room" (v4) @@ -358,14 +358,14 @@ Feature: chat-2/poll | 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 | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"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 | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | 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?"}} | + | room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"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) @@ -424,7 +424,7 @@ Feature: chat-2/poll | room | users | participant1 | participant1-displayname | conversation_created | 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?"}} | + | room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | Scenario: Non-moderators can not close polls of others Given user "participant1" creates room "room" (v4) @@ -450,7 +450,7 @@ Feature: chat-2/poll | maxVotes | unlimited | Then user "participant1" sees the following messages in room "room" with 200 | 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?"}} | + | room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | Then user "participant2" votes for options "[1]" on poll "What is the question?" in room "room" with 200 | id | POLL_ID(What is the question?) | | question | What is the question? | @@ -505,9 +505,9 @@ Feature: chat-2/poll | 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 | users | participant1 | poll_closed | You ended the poll {poll} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"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","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Number of voters and votes are restricted to the very same poll Given user "participant1" creates room "room" (v4) @@ -567,8 +567,8 @@ Feature: chat-2/poll | 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 | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Remove all votes Given user "participant1" creates room "room" (v4) @@ -623,8 +623,8 @@ Feature: chat-2/poll | 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 | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Empty question and options Given user "participant1" creates room "room" (v4) @@ -708,8 +708,8 @@ Feature: chat-2/poll | 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 | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"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","mention-id":"participant1"}} | Scenario: Deleting the poll message removes all details Given user "participant1" creates room "room" (v4) @@ -736,9 +736,9 @@ Feature: chat-2/poll | 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 | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Deleting a closed poll message removes also the close message Given user "participant1" creates room "room" (v4) @@ -780,10 +780,10 @@ Feature: chat-2/poll | 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 | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | + | room | users | participant1 | message_deleted | You deleted a message | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | + | room | users | participant1 | user_added | You added {user} | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | + | room | users | participant1 | conversation_created | You created the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Deleting the chat history also deletes polls Given user "participant1" creates room "room" (v4) diff --git a/tests/integration/features/chat-2/reaction.feature b/tests/integration/features/chat-2/reaction.feature index 7b05e971c0d..cb0a7cda2cf 100644 --- a/tests/integration/features/chat-2/reaction.feature +++ b/tests/integration/features/chat-2/reaction.feature @@ -180,7 +180,7 @@ Feature: chat-2/reaction Then user "participant1" deletes message "Message 1" from room "room" with 200 (v1) And user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | reactions | - | room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | [] | + | room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | [] | Scenario: Deleting a user neutralizes their details Given user "participant1" creates room "room" (v4) diff --git a/tests/integration/features/chat-2/rich-messages.feature b/tests/integration/features/chat-2/rich-messages.feature index 8682eea2231..ecc28064d97 100644 --- a/tests/integration/features/chat-2/rich-messages.feature +++ b/tests/integration/features/chat-2/rich-messages.feature @@ -21,7 +21,7 @@ Feature: chat-2/rich-messages When user "participant1" sends message "Mention to @participant2" to room "public room" with 201 Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | Mention to {mention-user1} | {"mention-user1":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | public room | users | participant1 | participant1-displayname | Mention to {mention-user1} | {"mention-user1":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | Scenario: message with mention to invalid user has mention parameter Given user "participant1" creates room "public room" (v4) @@ -39,7 +39,7 @@ Feature: chat-2/rich-messages When user "participant1" sends message "Mention to @participant2 and @participant2 again" to room "public room" with 201 Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | Mention to {mention-user1} and {mention-user1} again | {"mention-user1":{"type":"user","id":"participant2","name":"participant2-displayname"}} | + | public room | users | participant1 | participant1-displayname | Mention to {mention-user1} and {mention-user1} again | {"mention-user1":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} | Scenario: message with mentions to several users has mention parameters Given user "participant1" creates room "public room" (v4) @@ -48,7 +48,7 @@ Feature: chat-2/rich-messages When user "participant1" sends message "Mention to @participant2, @unknownUser, @participant2 again and @participant3" to room "public room" with 201 Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | Mention to {mention-user1}, @unknownUser, {mention-user1} again and {mention-user2} | {"mention-user1":{"type":"user","id":"participant2","name":"participant2-displayname"},"mention-user2":{"type":"user","id":"participant3","name":"participant3-displayname"}} | + | public room | users | participant1 | participant1-displayname | Mention to {mention-user1}, @unknownUser, {mention-user1} again and {mention-user2} | {"mention-user1":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"},"mention-user2":{"type":"user","id":"participant3","name":"participant3-displayname","mention-id":"participant3"}} | Scenario: message with mentions of subname users (uid1 is fully part of uid2) Given user "participant1" creates room "public room" (v4) @@ -58,5 +58,5 @@ Feature: chat-2/rich-messages When user "participant1" sends message "Mention to @participant3a and @participant3" to room "public room" with 201 Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | Mention to {mention-user1} and {mention-user2} | {"mention-user1":{"type":"user","id":"participant3a","name":"participant3a-displayname"},"mention-user2":{"type":"user","id":"participant3","name":"participant3-displayname"}} | - | public room | users | participant1 | participant1-displayname | Mention to {mention-user2} and {mention-user1} | {"mention-user1":{"type":"user","id":"participant3a","name":"participant3a-displayname"},"mention-user2":{"type":"user","id":"participant3","name":"participant3-displayname"}} | + | public room | users | participant1 | participant1-displayname | Mention to {mention-user1} and {mention-user2} | {"mention-user1":{"type":"user","id":"participant3a","name":"participant3a-displayname","mention-id":"participant3a"},"mention-user2":{"type":"user","id":"participant3","name":"participant3-displayname","mention-id":"participant3"}} | + | public room | users | participant1 | participant1-displayname | Mention to {mention-user2} and {mention-user1} | {"mention-user1":{"type":"user","id":"participant3a","name":"participant3a-displayname","mention-id":"participant3a"},"mention-user2":{"type":"user","id":"participant3","name":"participant3-displayname","mention-id":"participant3"}} | diff --git a/tests/integration/features/chat-2/rich-object-share.feature b/tests/integration/features/chat-2/rich-object-share.feature index 7158b019e43..8671aa5918f 100644 --- a/tests/integration/features/chat-2/rich-object-share.feature +++ b/tests/integration/features/chat-2/rich-object-share.feature @@ -10,7 +10,7 @@ Feature: chat-2/rich-object-share When user "participant1" shares rich-object "call" "R4nd0mT0k3n" '{"name":"Another room","call-type":"group"}' to room "public room" with 201 (v1) Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | + | public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | Scenario: Can not share without chat permission Given user "participant1" creates room "public room" (v4) @@ -31,7 +31,7 @@ Feature: chat-2/rich-object-share And user "participant1" deletes message "shared::call::R4nd0mT0k3n" from room "public room" with 200 Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | public room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | public room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | Scenario: Can not delete without chat permission Given user "participant1" creates room "public room" (v4) @@ -44,7 +44,7 @@ Feature: chat-2/rich-object-share And user "participant2" deletes message "shared::call::R4nd0mT0k3n" from room "public room" with 403 Then user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant2 | participant2-displayname | {object} | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | + | public room | users | participant2 | participant2-displayname | {object} | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | Scenario: Share an invalid rich object to a chat Given user "participant1" creates room "public room" (v4) @@ -68,7 +68,7 @@ Feature: chat-2/rich-object-share When user "participant1" shares rich-object "call" "R4nd0mT0k3n" '{"name":"Another room","call-type":"group"}' to room "public room" with 201 (v1) Then user "participant1" sees the following shared other in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | + | public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | When user "participant1" shares "welcome.txt" with room "public room" with OCS 100 Then user "participant1" sees the following shared file in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | diff --git a/tests/integration/features/command/user-remove.feature b/tests/integration/features/command/user-remove.feature index f6d1d87d976..34226f4b2b1 100644 --- a/tests/integration/features/command/user-remove.feature +++ b/tests/integration/features/command/user-remove.feature @@ -91,8 +91,8 @@ Feature: command/user-remove | room | participant2-displayname | 5 | 1 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | guests | cli | read_only | An administrator locked the conversation | {"actor":{"type":"guest","id":"guest\/cli","name":"Guest"}} | + | room | guests | cli | read_only | An administrator locked the conversation | {"actor":{"type":"guest","id":"guest\/cli","name":"Guest","mention-id":"guest\/cli"}} | | room | users | participant1 | call_tried | You tried to call {user} | {"user":{"type":"highlight","id":"deleted_users","name":"participant2-displayname"}} | - | room | users | participant1 | call_left | You left the call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | - | room | users | participant1 | call_started | You started a call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | call_left | You left the call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | + | room | users | participant1 | call_started | You started a call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | diff --git a/tests/integration/features/conversation-1/avatar.feature b/tests/integration/features/conversation-1/avatar.feature index 4be4c165b86..eeff6d9e8c7 100644 --- a/tests/integration/features/conversation-1/avatar.feature +++ b/tests/integration/features/conversation-1/avatar.feature @@ -128,7 +128,7 @@ Feature: conversation/avatar When user "participant1" shares rich-object "call" "R4nd0mT0k3n" '{"name":"Another room","call-type":"group"}' to room "public room" with 201 (v1) Then user "participant1" sees the following shared other in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | + | public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":"{VALIDATE_ICON_URL_PATTERN}"}} | Scenario: User sets emoji as avatar Given user "participant1" creates room "room" (v4) diff --git a/tests/integration/features/federation/invite.feature b/tests/integration/features/federation/invite.feature index 3d9f75567ef..f81a0b46a98 100644 --- a/tests/integration/features/federation/invite.feature +++ b/tests/integration/features/federation/invite.feature @@ -79,9 +79,9 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | # Remove a remote user after they joined When user "participant1" removes remote "participant2" from room "room" with 200 (v4) And user "participant2" has the following invitations (v1) @@ -91,10 +91,10 @@ Feature: federation/invite | users | participant1 | 1 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Invite user with wrong casing Given the following "spreed" app config is set @@ -190,9 +190,9 @@ Feature: federation/invite | users | participant1 | 1 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | federated_users | participant2@http://localhost:8180 | federated_user_removed | {federated_user} declined the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | federated_users | participant2@http://localhost:8180 | federated_user_removed | {federated_user} declined the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Remove remote user before they accept Given the following "spreed" app config is set @@ -225,9 +225,9 @@ Feature: federation/invite | users | participant1 | 1 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: User leaves after accepting Given the following "spreed" app config is set diff --git a/tests/integration/features/sharing-1/delete.feature b/tests/integration/features/sharing-1/delete.feature index 21ae2a58935..2015a4d5121 100644 --- a/tests/integration/features/sharing-1/delete.feature +++ b/tests/integration/features/sharing-1/delete.feature @@ -386,4 +386,4 @@ Feature: delete | recording | 0 | And user "participant1" sees the following messages in room "public room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | public room | users | participant1 | participant1-displayname | *You shared a file which is no longer available* | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | public room | users | participant1 | participant1-displayname | *You shared a file which is no longer available* | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | diff --git a/tests/php/Chat/Parser/SystemMessageTest.php b/tests/php/Chat/Parser/SystemMessageTest.php index 36c2f0e5daf..f7d03ea1d86 100644 --- a/tests/php/Chat/Parser/SystemMessageTest.php +++ b/tests/php/Chat/Parser/SystemMessageTest.php @@ -1130,6 +1130,7 @@ public function testGetGuest(string $attendeeType, string $actorId): void { 'type' => 'guest', 'id' => 'guest/' . $actorId, 'name' => 'name', + 'mention-id' => $expected, ], self::invokePrivate($parser, 'getGuest', [$room, $attendeeType, $actorId])); // Cached call: no call to getGuestName() again @@ -1137,6 +1138,7 @@ public function testGetGuest(string $attendeeType, string $actorId): void { 'type' => 'guest', 'id' => 'guest/' . $actorId, 'name' => 'name', + 'mention-id' => $expected, ], self::invokePrivate($parser, 'getGuest', [$room, $attendeeType, $actorId])); } diff --git a/tests/php/Chat/Parser/UserMentionTest.php b/tests/php/Chat/Parser/UserMentionTest.php index 2cb4fd44302..b8951498972 100644 --- a/tests/php/Chat/Parser/UserMentionTest.php +++ b/tests/php/Chat/Parser/UserMentionTest.php @@ -147,7 +147,8 @@ public function testGetRichMessageWithSingleMention(): void { 'mention-user1' => [ 'type' => 'user', 'id' => 'testUser', - 'name' => 'testUser display name' + 'name' => 'testUser display name', + 'mention-id' => 'testUser', ] ]; @@ -186,7 +187,8 @@ public function testGetRichMessageWithDuplicatedMention() { 'mention-user1' => [ 'type' => 'user', 'id' => 'testUser', - 'name' => 'testUser display name' + 'name' => 'testUser display name', + 'mention-id' => 'testUser', ] ]; @@ -254,12 +256,14 @@ public function testGetRichMessageWithMentionsFullyIncludedInOtherMentions(strin 'mention-user1' => [ 'type' => 'user', 'id' => $longerId, - 'name' => $longerId . ' display name' + 'name' => $longerId . ' display name', + 'mention-id' => $longerId, ], 'mention-user2' => [ 'type' => 'user', 'id' => $baseId, - 'name' => $baseId . ' display name' + 'name' => $baseId . ' display name', + 'mention-id' => $baseId, ], ]; @@ -306,17 +310,20 @@ public function testGetRichMessageWithSeveralMentions() { 'mention-user1' => [ 'type' => 'user', 'id' => 'testUser1', - 'name' => 'testUser1 display name' + 'name' => 'testUser1 display name', + 'mention-id' => 'testUser1', ], 'mention-user2' => [ 'type' => 'user', 'id' => 'testUser2', - 'name' => 'testUser2 display name' + 'name' => 'testUser2 display name', + 'mention-id' => 'testUser2', ], 'mention-user3' => [ 'type' => 'user', 'id' => 'testUser3', - 'name' => 'testUser3 display name' + 'name' => 'testUser3 display name', + 'mention-id' => 'testUser3', ] ]; @@ -358,7 +365,8 @@ public function testGetRichMessageWithNonExistingUserMention() { 'mention-user1' => [ 'type' => 'user', 'id' => 'testUser', - 'name' => 'testUser display name' + 'name' => 'testUser display name', + 'mention-id' => 'testUser', ] ]; @@ -396,7 +404,8 @@ public function testGetRichMessageWhenDisplayNameCanNotBeResolved() { 'mention-user1' => [ 'type' => 'user', 'id' => 'testUser', - 'name' => '' + 'name' => '', + 'mention-id' => 'testUser', ] ]; @@ -441,6 +450,7 @@ public function testGetRichMessageWithAtAll(): void { 'name' => 'name', 'call-type' => 'group', 'icon-url' => 'getAvatarUrl', + 'mention-id' => 'all', ] ]; @@ -482,6 +492,7 @@ public function testGetRichMessageWithFederatedUserMention(): void { 'id' => 'testUser', 'name' => 'Display Id', 'server' => 'example.tld', + 'mention-id' => 'federated_user/testUser@example.tld', ] ]; @@ -521,6 +532,7 @@ public function testGetRichMessageWhenAGuestWithoutNameIsMentioned(): void { 'type' => 'guest', 'id' => 'guest/123456', 'name' => 'Guest', + 'mention-id' => 'guest/123456', ] ]; @@ -560,6 +572,7 @@ public function testGetRichMessageWhenAGuestWithoutNameIsMentionedMultipleTimes( 'type' => 'guest', 'id' => 'guest/123456', 'name' => 'Guest', + 'mention-id' => 'guest/123456', ] ]; @@ -607,6 +620,7 @@ public function testGetRichMessageWhenAGuestWithANameIsMentionedMultipleTimes(): 'type' => 'guest', 'id' => 'guest/abcdef', 'name' => 'Name', + 'mention-id' => 'guest/abcdef', ] ]; From 4730d6e92594e9faf21f07f7d005bb6c5c495e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Tue, 11 Feb 2025 21:36:07 +0100 Subject: [PATCH 2/4] fix: Adjust test for mention-id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- lib/Chat/Parser/SystemMessage.php | 1 + .../features/chat-1/note-to-self.feature | 2 +- .../integration/features/chat-2/poll.feature | 2 +- .../features/federation/chat.feature | 8 +-- .../features/federation/invite.feature | 54 +++++++++---------- .../features/federation/poll.feature | 2 +- 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 2fe37600c48..cfc643d446a 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -985,6 +985,7 @@ protected function getCircle(string $circleId): array { 'id' => $circleId, 'name' => $this->circleNames[$circleId], 'url' => $this->circleLinks[$circleId], + 'mention-id' => 'team/' . $circleId, ]; } diff --git a/tests/integration/features/chat-1/note-to-self.feature b/tests/integration/features/chat-1/note-to-self.feature index 029ee86f9cd..3f298121196 100644 --- a/tests/integration/features/chat-1/note-to-self.feature +++ b/tests/integration/features/chat-1/note-to-self.feature @@ -21,4 +21,4 @@ Feature: chat/note-to-self | Note to self | 6 | Note to self | Then user "participant1" sees the following system messages in room "Note to self" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | systemMessage | - | Note to self | guests | system | | System created the conversation | {"actor":{"type":"guest","id":"guest\/system","name":"Guest"}} | conversation_created | + | Note to self | guests | system | | System created the conversation | {"actor":{"type":"guest","id":"guest\/system","name":"Guest","mention-id":"guest\/system"}} | conversation_created | diff --git a/tests/integration/features/chat-2/poll.feature b/tests/integration/features/chat-2/poll.feature index f056cd9c3d4..059c249976c 100644 --- a/tests/integration/features/chat-2/poll.feature +++ b/tests/integration/features/chat-2/poll.feature @@ -804,4 +804,4 @@ Feature: chat-2/poll 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 | users | participant1 | history_cleared | You cleared the history of the conversation | !ISSET | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | diff --git a/tests/integration/features/federation/chat.feature b/tests/integration/features/federation/chat.feature index 7cb827930e3..cfa1ed93e30 100644 --- a/tests/integration/features/federation/chat.feature +++ b/tests/integration/features/federation/chat.feature @@ -126,14 +126,14 @@ Feature: federation/chat And user "participant2" deletes message "Message 1-1 - Edit 1" from room "LOCAL::room" with 200 Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | room | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"{$REMOTE_URL}"}} | Message deleted by you | - | room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | | + | room | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"{$REMOTE_URL}","mention-id":"federated_user\/participant2@{$LOCAL_REMOTE_URL}"}} | Message deleted by you | + | room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | When next message request has the following parameters set | timeout | 0 | And user "participant2" sees the following messages in room "LOCAL::room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | LOCAL::room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | Message deleted by author | - | LOCAL::room | federated_users | participant1@{$BASE_URL} | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","server":"{$BASE_URL}"}} | | + | LOCAL::room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"federated_user\/participant2@{$LOCAL_REMOTE_URL}"}} | Message deleted by author | + | LOCAL::room | federated_users | participant1@{$BASE_URL} | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1","server":"{$BASE_URL}"}} | | Then user "participant2" is participant of the following rooms (v4) | id | type | lastMessage | | LOCAL::room | 2 | Message deleted by author | diff --git a/tests/integration/features/federation/invite.feature b/tests/integration/features/federation/invite.feature index f81a0b46a98..5ce1993d837 100644 --- a/tests/integration/features/federation/invite.feature +++ b/tests/integration/features/federation/invite.feature @@ -38,8 +38,8 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4) Then user "participant2" is participant of the following rooms (v4) | id | name | type | @@ -50,8 +50,8 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And force run "OCA\Talk\BackgroundJob\RemoveEmptyRooms" background jobs And user "participant2" has the following invitations (v1) | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName | @@ -109,8 +109,8 @@ Feature: federation/invite | federated_users | PARTICIPANT2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/PARTICIPANT2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And user "participant1" adds federated_user "participant2" to room "room" with 404 (v4) When user "participant1" sees the following attendees in room "room" with 200 (v4) | actorType | actorId | participantType | @@ -118,8 +118,8 @@ Feature: federation/invite | federated_users | PARTICIPANT2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/PARTICIPANT2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And force run "OCA\Talk\BackgroundJob\RemoveEmptyRooms" background jobs And user "participant2" has the following invitations (v1) | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName | localCloudId | @@ -143,9 +143,9 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/PARTICIPANT2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | # Remove a remote user after they joined When user "participant1" removes remote "participant2" from room "room" with 200 (v4) And user "participant2" has the following invitations (v1) @@ -155,10 +155,10 @@ Feature: federation/invite | users | participant1 | 1 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"PARTICIPANT2","name":"PARTICIPANT2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/PARTICIPANT2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Declining an invite Given the following "spreed" app config is set @@ -173,8 +173,8 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And user "participant2" has the following invitations (v1) | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName | | LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname | @@ -207,8 +207,8 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And force run "OCA\Talk\BackgroundJob\RemoveEmptyRooms" background jobs And user "participant2" has the following invitations (v1) | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName | @@ -242,8 +242,8 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4) When user "participant1" sees the following attendees in room "room" with 200 (v4) | actorType | actorId | participantType | @@ -251,8 +251,8 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And force run "OCA\Talk\BackgroundJob\RemoveEmptyRooms" background jobs And user "participant2" has the following invitations (v1) | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName | @@ -275,10 +275,10 @@ Feature: federation/invite | users | participant1 | 1 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | federated_users | participant2@http://localhost:8180 | federated_user_removed | {federated_user} declined the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} | - | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | + | room | federated_users | participant2@http://localhost:8180 | federated_user_removed | {federated_user} declined the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | Scenario: Federate conversation meta data Given the following "spreed" app config is set diff --git a/tests/integration/features/federation/poll.feature b/tests/integration/features/federation/poll.feature index 430ccb9f498..e01f24b0668 100644 --- a/tests/integration/features/federation/poll.feature +++ b/tests/integration/features/federation/poll.feature @@ -26,7 +26,7 @@ Feature: federation/poll | maxVotes | unlimited | Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | - | room | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | {object} | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | + | room | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | {object} | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"},"object":{"type":"talk-poll","id":POLL_ID(What is the question?),"name":"What is the question?"}} | Then user "participant2" sees poll "What is the question?" in room "LOCAL::room" with 200 | id | POLL_ID(What is the question?) | | question | What is the question? | From 89c90c4b759c919df880aae67591040c6143e384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Tue, 11 Feb 2025 21:56:37 +0100 Subject: [PATCH 3/4] fix: Unit tests for mention-id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- lib/Chat/Parser/SystemMessage.php | 2 +- tests/php/Chat/Parser/SystemMessageTest.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index cfc643d446a..9cde219f401 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -1033,7 +1033,7 @@ protected function getGuest(Room $room, string $actorType, string $actorId): arr 'type' => 'guest', 'id' => 'guest/' . $actorId, 'name' => $this->guestNames[$key], - 'mention-id' => ($actorType === Attendee::ACTOR_GUESTS ? 'guest/' : 'email/') . $actorId, + 'mention-id' => 'guest/' . $actorId, ]; } diff --git a/tests/php/Chat/Parser/SystemMessageTest.php b/tests/php/Chat/Parser/SystemMessageTest.php index f7d03ea1d86..076d3ef3d76 100644 --- a/tests/php/Chat/Parser/SystemMessageTest.php +++ b/tests/php/Chat/Parser/SystemMessageTest.php @@ -1106,8 +1106,8 @@ public function testGetDisplayNameGroup(string $gid, bool $validGroup, string $n public static function dataGetGuest(): array { return [ - [Attendee::ACTOR_GUESTS, sha1('name')], - [Attendee::ACTOR_EMAILS, 'test@test.tld'], + [Attendee::ACTOR_GUESTS, sha1('name'), 'guest/' . sha1('name')], + [Attendee::ACTOR_EMAILS, hash('sha256', 'test@test.tld'), 'guest/' . hash('sha256', 'test@test.tld')], ]; } @@ -1115,8 +1115,9 @@ public static function dataGetGuest(): array { * @dataProvider dataGetGuest * @param string $attendeeType * @param string $actorId + * @param string $expected */ - public function testGetGuest(string $attendeeType, string $actorId): void { + public function testGetGuest(string $attendeeType, string $actorId, string $expected): void { /** @var Room|MockObject $room */ $room = $this->createMock(Room::class); @@ -1128,7 +1129,7 @@ public function testGetGuest(string $attendeeType, string $actorId): void { $this->assertSame([ 'type' => 'guest', - 'id' => 'guest/' . $actorId, + 'id' => $expected, 'name' => 'name', 'mention-id' => $expected, ], self::invokePrivate($parser, 'getGuest', [$room, $attendeeType, $actorId])); @@ -1136,7 +1137,7 @@ public function testGetGuest(string $attendeeType, string $actorId): void { // Cached call: no call to getGuestName() again $this->assertSame([ 'type' => 'guest', - 'id' => 'guest/' . $actorId, + 'id' => $expected, 'name' => 'name', 'mention-id' => $expected, ], self::invokePrivate($parser, 'getGuest', [$room, $attendeeType, $actorId])); From 2b5b187b71cef8100828ba1f9528fc4f7fe10649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Tue, 11 Feb 2025 22:01:56 +0100 Subject: [PATCH 4/4] fix: Adjust federation tests for mention-id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- tests/integration/features/federation/chat.feature | 4 ++-- tests/integration/features/federation/invite.feature | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/features/federation/chat.feature b/tests/integration/features/federation/chat.feature index cfa1ed93e30..2a4284b94a4 100644 --- a/tests/integration/features/federation/chat.feature +++ b/tests/integration/features/federation/chat.feature @@ -126,13 +126,13 @@ Feature: federation/chat And user "participant2" deletes message "Message 1-1 - Edit 1" from room "LOCAL::room" with 200 Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | room | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"{$REMOTE_URL}","mention-id":"federated_user\/participant2@{$LOCAL_REMOTE_URL}"}} | Message deleted by you | + | room | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","server":"{$REMOTE_URL}","mention-id":"federated_user\/participant2@{$REMOTE_URL}"}} | Message deleted by you | | room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | | When next message request has the following parameters set | timeout | 0 | And user "participant2" sees the following messages in room "LOCAL::room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | - | LOCAL::room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"federated_user\/participant2@{$LOCAL_REMOTE_URL}"}} | Message deleted by author | + | LOCAL::room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"federated_user\/participant2@{$REMOTE_URL}"}} | Message deleted by author | | LOCAL::room | federated_users | participant1@{$BASE_URL} | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1","server":"{$BASE_URL}"}} | | Then user "participant2" is participant of the following rooms (v4) | id | type | lastMessage | diff --git a/tests/integration/features/federation/invite.feature b/tests/integration/features/federation/invite.feature index 5ce1993d837..131166d2114 100644 --- a/tests/integration/features/federation/invite.feature +++ b/tests/integration/features/federation/invite.feature @@ -173,7 +173,7 @@ Feature: federation/invite | federated_users | participant2 | 3 | Then user "participant1" sees the following system messages in room "room" with 200 | room | actorType | actorId | systemMessage | message | messageParameters | - | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | + | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180","mention-id":"federated_user\/participant2@http:\/\/localhost:8180"}} | | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} | And user "participant2" has the following invitations (v1) | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |