diff options
author | Joas Schilling <coding@schilljs.com> | 2024-03-13 16:56:03 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-03-14 09:47:19 +0100 |
commit | 6d5de533a6f00e950c4b5ce202c5587e59ca9ba0 (patch) | |
tree | 4777c346472dff6c3cd0d555916a69a59926cd21 | |
parent | 2e947ea83cfbe462043af920da239903904bcec1 (diff) |
fix(federation): Send the display name when accepting the invite
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Federation/BackendNotifier.php | 2 | ||||
-rw-r--r-- | lib/Federation/CloudFederationProviderTalk.php | 5 | ||||
-rw-r--r-- | lib/Federation/FederationManager.php | 2 | ||||
-rw-r--r-- | tests/integration/features/federation/chat.feature | 16 | ||||
-rw-r--r-- | tests/integration/features/federation/invite.feature | 4 | ||||
-rw-r--r-- | tests/php/Federation/FederationTest.php | 3 |
6 files changed, 20 insertions, 12 deletions
diff --git a/lib/Federation/BackendNotifier.php b/lib/Federation/BackendNotifier.php index 15cfb0ac3..cb2102afe 100644 --- a/lib/Federation/BackendNotifier.php +++ b/lib/Federation/BackendNotifier.php @@ -179,6 +179,7 @@ class BackendNotifier { int $remoteAttendeeId, #[SensitiveParameter] string $accessToken, + string $displayName, ): bool { $remote = $this->prepareRemoteUrl($remoteServerUrl); @@ -191,6 +192,7 @@ class BackendNotifier { 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, 'message' => 'Recipient accepted the share', + 'displayName' => $displayName, ] ); diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php index 4615585af..8b3340388 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -213,6 +213,11 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { private function shareAccepted(int $id, array $notification): array { $attendee = $this->getLocalAttendeeAndValidate($id, $notification['sharedSecret']); + if (!empty($notification['displayName'])) { + $attendee->setDisplayName($notification['displayName']); + $this->attendeeMapper->update($attendee); + } + $this->session->set('talk-overwrite-actor-type', $attendee->getActorType()); $this->session->set('talk-overwrite-actor-id', $attendee->getActorId()); $this->session->set('talk-overwrite-actor-displayname', $attendee->getDisplayName()); diff --git a/lib/Federation/FederationManager.php b/lib/Federation/FederationManager.php index b5bd2ea25..88b56f4ca 100644 --- a/lib/Federation/FederationManager.php +++ b/lib/Federation/FederationManager.php @@ -134,7 +134,7 @@ class FederationManager { // Add user to the room $room = $this->manager->getRoomById($invitation->getLocalRoomId()); if ( - !$this->backendNotifier->sendShareAccepted($invitation->getRemoteServerUrl(), $invitation->getRemoteAttendeeId(), $invitation->getAccessToken()) + !$this->backendNotifier->sendShareAccepted($invitation->getRemoteServerUrl(), $invitation->getRemoteAttendeeId(), $invitation->getAccessToken(), $user->getDisplayName()) ) { throw new CannotReachRemoteException(); } diff --git a/tests/integration/features/federation/chat.feature b/tests/integration/features/federation/chat.feature index 6636b0ea8..0849772cd 100644 --- a/tests/integration/features/federation/chat.feature +++ b/tests/integration/features/federation/chat.feature @@ -22,10 +22,10 @@ Feature: federation/chat | id | type | | room | 2 | And user "participant1" gets the following candidate mentions in room "room" for "" with 200 - | source | id | label | mentionId | - | calls | all | room | all | - | federated_users | participant2@{$REMOTE_URL} | participant2@localhost:8180 | federated_user/participant2@{$REMOTE_URL} | - | users | participant3 | participant3-displayname | participant3 | + | source | id | label | mentionId | + | calls | all | room | all | + | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | federated_user/participant2@{$REMOTE_URL} | + | users | participant3 | participant3-displayname | participant3 | And user "participant2" gets the following candidate mentions in room "LOCAL::room" for "" with 200 | source | id | label | mentionId | | calls | all | room | all | @@ -56,10 +56,10 @@ Feature: federation/chat | id | type | | room | 2 | And user "participant1" gets the following candidate mentions in room "room" for "" with 200 - | source | id | label | mentionId | - | calls | all | room | all | - | federated_users | participant2@{$REMOTE_URL} | participant2@localhost:8180 | federated_user/participant2@{$REMOTE_URL} | - | federated_users | participant3@{$REMOTE_URL} | participant3@localhost:8180 | federated_user/participant3@{$REMOTE_URL} | + | source | id | label | mentionId | + | calls | all | room | all | + | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | federated_user/participant2@{$REMOTE_URL} | + | federated_users | participant3@{$REMOTE_URL} | participant3-displayname | federated_user/participant3@{$REMOTE_URL} | And user "participant2" gets the following candidate mentions in room "LOCAL::room" for "" with 200 | source | id | label | mentionId | | calls | all | room | all | diff --git a/tests/integration/features/federation/invite.feature b/tests/integration/features/federation/invite.feature index 9136077e5..684a29bc3 100644 --- a/tests/integration/features/federation/invite.feature +++ b/tests/integration/features/federation/invite.feature @@ -72,8 +72,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 | 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 | 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"}} | # Remove a remote user after they joined When user "participant1" removes remote "participant2" from room "room" with 200 (v4) diff --git a/tests/php/Federation/FederationTest.php b/tests/php/Federation/FederationTest.php index 36b9143ec..10e4c1c93 100644 --- a/tests/php/Federation/FederationTest.php +++ b/tests/php/Federation/FederationTest.php @@ -404,6 +404,7 @@ class FederationTest extends TestCase { 'sharedSecret' => $token, 'message' => 'Recipient accepted the share', 'remoteServerUrl' => 'http://example.tld', + 'displayName' => 'Foo Bar', ] ); @@ -428,7 +429,7 @@ class FederationTest extends TestCase { ->with('/') ->willReturn('http://example.tld/index.php/'); - $success = $this->backendNotifier->sendShareAccepted($remote, $id, $token); + $success = $this->backendNotifier->sendShareAccepted($remote, $id, $token, 'Foo Bar'); $this->assertTrue($success); } |