From e0169816ed7f0aa89875e9df49c2d524ffa50946 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 11 Oct 2023 10:57:26 +0200 Subject: [PATCH 1/5] fix(federation): Fix missing federated user in system message Signed-off-by: Joas Schilling --- lib/Chat/Parser/SystemMessage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index cc48a93f97d..c9f91c17eca 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -289,11 +289,11 @@ public function parseMessage(Message $chatMessage): void { } } elseif ($message === 'federated_user_added') { $parsedParameters['federated_user'] = $this->getRemoteUser($parameters['federated_user']); - $parsedMessage = $this->l->t('{actor} invited {user}'); + $parsedMessage = $this->l->t('{actor} invited {federated_user}'); if ($currentUserIsActor) { - $parsedMessage = $this->l->t('You invited {user}'); + $parsedMessage = $this->l->t('You invited {federated_user}'); } elseif ($cliIsActor) { - $parsedMessage = $this->l->t('An administrator invited {user}'); + $parsedMessage = $this->l->t('An administrator invited {federated_user}'); } elseif ($parsedParameters['federated_user']['id'] === $parsedParameters['actor']['id']) { $parsedMessage = $this->l->t('{federated_user} accepted the invitation'); } From fd7ff9393bbb46e5d2aa9dbd19191b35db316470 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 11 Oct 2023 10:58:32 +0200 Subject: [PATCH 2/5] fix(federation): Don't highlight federated users as normal users or even primary Signed-off-by: Joas Schilling --- .../Message/MessagePart/Mention.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/Mention.vue b/src/components/MessagesList/MessagesGroup/Message/MessagePart/Mention.vue index 6fb1b6e4268..79e36b0772a 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/Mention.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/Mention.vue @@ -33,6 +33,10 @@ :display-name="name" :avatar-image="'icon-user-forced-white'" :primary="isCurrentGuest" /> + Date: Wed, 11 Oct 2023 10:59:01 +0200 Subject: [PATCH 3/5] fix(chat): Fix CSS selector for avatars Signed-off-by: Joas Schilling --- css/icons.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/icons.css b/css/icons.css index 5fc3bb26fbd..7a9e4af95ca 100644 --- a/css/icons.css +++ b/css/icons.css @@ -71,12 +71,12 @@ * .app-Talk rules above. * "forced-white" needs to be included in the class name as the Avatar does * not accept several classes. */ -.mention-bubble__icon.icon-group-forced-white, +.user-bubble__avatar .avatar-class-icon.icon-group-forced-white, .tribute-container .icon-group-forced-white { background-image: url(../img/icon-contacts-white.svg); } -.mention-bubble__icon.icon-user-forced-white, +.user-bubble__avatar .avatar-class-icon.icon-user-forced-white, .tribute-container .icon-user-forced-white { background-image: url(../img/icon-user-white.svg) } From 241710985d46952a31274e6fc4d1b23235b64fca Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 11 Oct 2023 10:59:41 +0200 Subject: [PATCH 4/5] fix(federation): Don't use group avatar for federated users Signed-off-by: Joas Schilling --- src/components/AvatarWrapper/AvatarWrapper.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/AvatarWrapper/AvatarWrapper.vue b/src/components/AvatarWrapper/AvatarWrapper.vue index 88524a99684..df0f8f1e721 100644 --- a/src/components/AvatarWrapper/AvatarWrapper.vue +++ b/src/components/AvatarWrapper/AvatarWrapper.vue @@ -121,6 +121,9 @@ export default { if (!this.source || this.isUser || this.isBot || this.isGuest || this.isDeletedUser) { return '' } + if (this.isRemoteUser) { + return 'icon-user' + } if (this.source === 'emails') { return 'icon-mail' } @@ -146,6 +149,9 @@ export default { isUser() { return this.source === 'users' || this.source === ATTENDEE.ACTOR_TYPE.BRIDGED }, + isRemoteUser() { + return this.source === 'federated_users' + }, isBot() { return this.source === 'bots' && this.id !== 'changelog' }, From 29156f1f64ae6243276dd5027c70f64c55734dcd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 11 Oct 2023 14:03:29 +0200 Subject: [PATCH 5/5] fix(federation): Fix integration test and document messages Signed-off-by: Joas Schilling --- docs/chat.md | 2 ++ tests/integration/features/federation/invite.feature | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/chat.md b/docs/chat.md index 654dc6c9bdd..771bc76fce8 100644 --- a/docs/chat.md +++ b/docs/chat.md @@ -498,3 +498,5 @@ See [OCP\RichObjectStrings\Definitions](https://github.com/nextcloud/server/blob * `audio_recording_stopped` - {actor} stopped an audio recording * `avatar_set` - {actor} set the conversation avatar * `avatar_removed` - {actor} removed the conversation avatar +* `federated_user_added` - {actor} invited {federated_user} / {federated_user} accepted the invitation +* `federated_user_removed` - {actor} removed {federated_user} / {federated_user} declined the invitation diff --git a/tests/integration/features/federation/invite.feature b/tests/integration/features/federation/invite.feature index 1bff38b3d69..b270a70e82e 100644 --- a/tests/integration/features/federation/invite.feature +++ b/tests/integration/features/federation/invite.feature @@ -27,7 +27,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 {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"}} | And user "participant2" has the following invitations (v1) | remote_server | remote_token | @@ -44,7 +44,7 @@ Feature: federation/invite 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@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 {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"}} | Scenario: Declining an invite @@ -60,7 +60,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 {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"}} | And user "participant2" has the following invitations (v1) | remote_server | remote_token | @@ -76,7 +76,7 @@ Feature: federation/invite 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 {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"}} | Scenario: Authenticate as a federation user