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

Return room identifier and known servers when resolving alias #1426

Merged
merged 2 commits into from
Mar 29, 2022

Conversation

Anderas
Copy link
Contributor

@Anderas Anderas commented Mar 28, 2022

Relates to element-hq/element-ios#4858

The directory/room/<room_alias> endpoint used to convert room alias to a room identifier returns a list of servers that are aware of the room. In the existing SDK implementation this list of servers is never stored (we only grab the identifier), meaning that if we later want to join this room from another home server, it is no longer possible without the knowledge of the servers.

To solve this on the SDK side, store both room_id as well as list of servers in a new MXRoomAliasResolution object which can be fetched via resolveRoomAlias endpoint, replacing the simpler roomIdForAlias

Copy link
Contributor

@aringenbach aringenbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

XCTAssertEqualObjects(roomId2, roomId, @"Mapping from room alias to room ID is wrong");
XCTAssertNotNil(resolution);
XCTAssertNotEqual(resolution.roomId.length, 0);
XCTAssertEqualObjects(resolution.roomId, roomId, @"Mapping from room alias to room ID is wrong");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could test something relevant on the servers list 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yea! I was going to do that and then it slipped my mind, thanks!

@Anderas Anderas merged commit 3335da3 into develop Mar 29, 2022
@Anderas Anderas deleted the andy/4858_resolve_alias branch March 29, 2022 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants