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

[Story] Check room's address for invalid symbols and availability #2585

Open
3 of 4 tasks
mxandreas opened this issue Oct 16, 2024 · 6 comments
Open
3 of 4 tasks

[Story] Check room's address for invalid symbols and availability #2585

mxandreas opened this issue Oct 16, 2024 · 6 comments

Comments

@mxandreas
Copy link

mxandreas commented Oct 16, 2024

Description

  • As a user creating a public room or changing an existing room to be public
  • I want to know if the room address is valid (does not have any invalid symbols) and available when I am editing it
  • So that I can correct my mistakes instantly; or be happy that the address I desire is available.

Checking the address for both invalid symbols and availability is done "in live" as the user is editing the address.

Since this a functionality that already exists in EW, the algorithm for checking for invalid symbols and other constraints is borrowed from EW which currently prevents using the following symbols:

(Note that Matrix spec on identifiers unfortunately does not specify any specific rules for the local part of room alias.)

Same goes for checking if the room address is available - the approach for this can be borrowed from EW and adjusted as necessary.

Note that these checks would need to be applied both at room creation and when changing room settings later.

Designs:

Acceptance criteria

  • When user types a symbol that is not allowed they get a hint that there are invalid symbols.
  • When user corrects their mistakes and the address is valid, the hint for invalid symbols disappers.
  • When user enters an address that is valid but not available they get a hint that the address is already in use.
  • TBC: When user enters an address that is valid and available they get a confirmation that the address is available (applicable to EW only).

Size estimate

None

Dependencies

  • None

Out of scope

  • Nothing

Open questions

Questions

Subtasks

Android

  1. T-Task
    ganfra

iOS

No tasks being tracked yet.

Rust

No tasks being tracked yet.

Other

No tasks being tracked yet.
@mxandreas mxandreas changed the title [Story] Check room's address for invalid symbols and uniqueness [Story] Check room's address for invalid symbols and availability Oct 16, 2024
@mxandreas
Copy link
Author

It seems the Matrix spec does not define a clear grammar for the local part (#local_part:homeserver.com) of the room alias, and thus what's implemented on EW, seems to be its own best practice. As there is no good reason to change it, and we want the clients to be in sync - @florianduros could you please point out the code in EW which validates the room alias, so we can use this as a reference when implementing in EX and also use to describe to user on UI what is allowed and what is not.

@mxandreas
Copy link
Author

mxandreas commented Oct 18, 2024

@jmartinesp Has found the corresponding code in EW, this prevents using:

We will stick to this implementation as a change is currently not justified, and not directly related to the scope. The tips on the UI for the end user may be slightly more restrictive for the purpose of keeping it understandable for them.

@jmartinesp
Copy link
Member

FWIW this is already handled in Rust in the Ruma crate. Maybe instead of adding custom logic per-client we should create a shared fn is_valid_room_alias(raw: String) -> bool in Rust that tries to create an alias from a raw string, and returns true if it can be created?

@mxandreas
Copy link
Author

A note that for checking the availability of the address, EW is using this API, e.g. making a GET request to:

https://beta.ems.host/_matrix/client/v3/directory/room/%23xy%3Abeta.matrix.org

@mxandreas
Copy link
Author

mxandreas commented Nov 8, 2024

Updated the description to confirm that we check the availability as well as invalid symbols "live" as user is editing the address.

@mxandreas
Copy link
Author

mxandreas commented Nov 8, 2024

Agreed that we do not introduce the "green confirmation" that address is available on EX. To be decided if we keep it on EW where it already exists.

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

2 participants