Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Federation invitation from stable29 to main fails #12654

Closed
SystemKeeper opened this issue Jul 9, 2024 · 5 comments · Fixed by #12661
Closed

Federation invitation from stable29 to main fails #12654

SystemKeeper opened this issue Jul 9, 2024 · 5 comments · Fixed by #12661
Assignees
Labels
Milestone

Comments

@SystemKeeper
Copy link
Contributor

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Create a conversation on a stable29-instance
  2. Try to invite a user from a main instance

Expected behaviour

Should work

Actual behaviour

User is invited and directly removed again, but the invitation shows up on the main instance (although unable to accept it).

On the stable29 instance:

Error while sending notification to federation server: Client error: POST https://main-instance/ocm/notifications resulted in a `400 Bad request`

When trying again to invite the same user:

{
  "reqId": "UVfKPjzyNAPpzdU0UuHn",
  "level": 2,
  "time": "2024-07-09T07:05:12+00:00",
  "remoteAddr": "...",
  "user": "...",
  "app": "spreed",
  "method": "POST",
  "url": "/ocs/v2.php/apps/spreed/api/v4/room/<room>/participants",
  "message": "Failed sharing <room> with <user>, received status code 501\n{\"message\":\"User already invited\"}",
  "userAgent": "Mozilla/5.0 (Linux) Nextcloud-Talk v0.31.0",
  "version": "29.0.3.4",
  "data": {
    "app": "spreed"
  }
}
@SystemKeeper SystemKeeper added 1. to develop bug feature: api 🛠️ OCS API for conversations, chats and participants feature: federation 🌐 labels Jul 9, 2024
@SystemKeeper SystemKeeper added this to the 💚 Next Patch (29) milestone Jul 9, 2024
@nickvergessen
Copy link
Member

nickvergessen commented Jul 9, 2024

@nickvergessen
Copy link
Member

@nickvergessen
Copy link
Member

Todo

  • Rooms that made an invite are not recoverable
  • Find out why the remote knows about the invite (notification etc) when it didn't work locally

@nickvergessen nickvergessen self-assigned this Jul 9, 2024
@github-project-automation github-project-automation bot moved this to 🧭 Planning evaluation (don't pick) in 💬 Talk team Jul 9, 2024
@nickvergessen nickvergessen moved this from 🧭 Planning evaluation (don't pick) to 📄 To do (~10 entries) in 💬 Talk team Jul 9, 2024
@nickvergessen
Copy link
Member

nickvergessen commented Jul 9, 2024

Patch

diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php
index c49a64c20..b95b525fe 100644
--- a/lib/Federation/CloudFederationProviderTalk.php
+++ b/lib/Federation/CloudFederationProviderTalk.php
@@ -510,8 +519,15 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
                try {
                        return $this->invitationMapper->getByRemoteAndAccessToken($remoteServerUrl, $remoteAttendeeId, $sharedSecret);
                } catch (DoesNotExistException) {
-                       throw new ShareNotFound(FederationManager::OCM_RESOURCE_NOT_FOUND);
+                       if (!$this->addressHandler->urlContainProtocol($remoteServerUrl)) {
+                               try {
+                                       return $this->invitationMapper->getByRemoteAndAccessToken('https://' . $remoteServerUrl, $remoteAttendeeId, $sharedSecret);
+                               } catch (DoesNotExistException) {
+                               }
+                       }
                }
+
+               throw new ShareNotFound(FederationManager::OCM_RESOURCE_NOT_FOUND);
        }
 
        private function notifyAboutNewShare(IUser $shareWith, string $inviteId, string $sharedByFederatedId, string $sharedByName, string $roomName, string $remoteRoomToken, string $remoteServerUrl): void {

💭 Thoughts

  • Either expect to receive it without protocol, then we should strip it from invites when they contain it
  • Or we expect to receive with protocol, then we should add it to invites that are missing it

@nickvergessen
Copy link
Member

I think expecting the protocol is the better idea going forward as that is what will be send.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ☑️ Done
Development

Successfully merging a pull request may close this issue.

2 participants