Open mxandreas opened 1 month ago
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.
@jmartinesp Has found the corresponding code in EW, this prevents using:
:
, ,
and #
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.
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?
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
Updated the description to confirm that we check the availability as well as invalid symbols "live" as user is editing the address.
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.
Description
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:
:
,,
and#
(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
Size estimate
None
Dependencies
Out of scope
Open questions
Subtasks