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

Cannot invite user to federated room #17273

Closed
ndroo opened this issue Apr 13, 2020 · 11 comments
Closed

Cannot invite user to federated room #17273

ndroo opened this issue Apr 13, 2020 · 11 comments

Comments

@ndroo
Copy link
Contributor

ndroo commented Apr 13, 2020

Using RC 3.0.10

Unless I've first had a direct message conversation between two users across federated servers, i cannot invite users into my federated channels.

Steps to reproduce:

  1. Setup 2 servers via federation (Server A and Server B. Server A must contain 1 User, Server B must contain 2 users)
  2. Log onto Server A using User 1
  3. From Server A, lookup User 1 from Server B and create a private conversation
  4. Create a new private channel on server A and invite User 1 from Server B

At this point you should have two channels in server A

  • Direct message between User 1 from Server A and User 1 from Server B
  • Private Channel between User 1 from Server A and User 1 from Server B
  1. Log onto Server B using User 1
  2. Go to the Federate Private channel that has been created between User 1 from Server B and User 1 from Server A
  3. Try and invite User 2 from Server B into the federated channel (This will fail, this is the bug!)

You will see in the logs

server.js:204 Federation ➔ client.error afterAddedToRoom => Could not add user: TypeError: Cannot read property 'origin' of undefined
at app/federation/server/hooks/afterAddedToRoom.js:48:58
at Array.map ()
at app/federation/server/hooks/afterAddedToRoom.js:48:34
at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40

This is because User 2 from Server B does not exist on Server A.

To make it work anyway...

  1. Log onto Server A
  2. Lookup User 2 on Server B and create a direct message conversation
  3. Redo Steps 5-7 from above, it now works.

I think we just need step 7 from above to create the user on the peer server(s) when doing the invite in order to resolve this issue.

@ndroo
Copy link
Contributor Author

ndroo commented Apr 13, 2020

I think this is related to #16396. @alansikora i suspect you also want this resolved

@1rV1N-git
Copy link
Contributor

Hello.
Use 3.0.10
#16878

@ndroo
Copy link
Contributor Author

ndroo commented Apr 13, 2020

The fact i'm using 3.0.10 is literally the first line of my bug report @1rV1N-git.

@1rV1N-git
Copy link
Contributor

1rV1N-git commented Apr 13, 2020

@ndroo
sorry. You need 3.1.0

@ndroo
Copy link
Contributor Author

ndroo commented Apr 13, 2020

Oh? if this is actually fixed there ill work towards merging that in on our side. I couldn't find any indication that the upgrade would help though?

@1rV1N-git
Copy link
Contributor

#16878

@ndroo
Copy link
Contributor Author

ndroo commented Apr 13, 2020

Can you point at the specific commit? If you're talking about the typo commit (ccec102) this is already merged into 3.0.10. So i still think i'm reporting a new issue.

@1rV1N-git
Copy link
Contributor

hm. Maybe it is another bug.

@ndroo
Copy link
Contributor Author

ndroo commented Apr 13, 2020

Yeah agreed.

@ndroo ndroo changed the title Bug: Federation - Cannot invite user to federated room Cannot invite user to federated room Apr 14, 2020
@ndroo
Copy link
Contributor Author

ndroo commented Apr 15, 2020

So i looked into this, the issue is the user being added (Server B, user 2) doesnt have the federation attribute on their user object, because they're just a local (non federated) user at this time.

This is happening on this line.

const domainsAfterAdd = users.map((u) => u.federation.origin);

I wrote a bit of code that deals with this and resolves the issue i've encountered, i'll submit a PR shortly.

@ndroo
Copy link
Contributor Author

ndroo commented Apr 18, 2020

This has been solved in a PR we're going to be sending over in a few days. Please see my comments in the rocketchat federated room channel for more info (messages dated april 18th 2020).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants