Closed Bug 1657797 Opened 4 years ago Closed 4 years ago

Join Chat appends Matrix server name preventing us to join a different homeserver

Categories

(Chat Core :: Matrix, defect, P1)

Thunderbird 81

Tracking

(thunderbird_esr78+ fixed, thunderbird81 affected)

RESOLVED FIXED
82 Branch
Tracking Status
thunderbird_esr78 + fixed
thunderbird81 --- affected

People

(Reporter: sdk, Assigned: khushil324)

References

Details

Attachments

(1 file, 3 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

Steps to reproduce:

  1. Open the Chat tab
  2. Connect to your Matrix account (e.g. @username:matrix.org)
  3. Click on "Join Chat" button
  4. Enter a room name from a different homeserver (e.g. #maildev:mozilla.org)

Actual results:

The chat join a room called #room_name:server_name:account_server_name.tld (e.g. #maildev:mozilla.org:matrix.org)

Expected results:

If a server name is specified, Join Chat shouldn't append the account server name.

Blocks: 1572636
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P1

I think Khushil had a patch for this?

Assignee: nobody → khushil324
Status: NEW → ASSIGNED
Attachment #9170440 - Flags: review?(clokep)
Comment on attachment 9170440 [details] [diff] [review]
Bug-1657797_update-join-chat-matrix-0.patch

Review of attachment 9170440 [details] [diff] [review]:
-----------------------------------------------------------------

::: chat/protocols/matrix/matrix.jsm
@@ +812,3 @@
>      // For the format of room id and alias, see the matrix documentation:
>      // https://matrix.org/docs/spec/intro.html#room-structure
>      // https://matrix.org/docs/spec/intro.html#room-aliases

Please update these links to:

https://matrix.org/docs/spec/appendices#room-ids-and-event-ids
https://matrix.org/docs/spec/appendices#room-aliases

@@ +812,5 @@
>      // For the format of room id and alias, see the matrix documentation:
>      // https://matrix.org/docs/spec/intro.html#room-structure
>      // https://matrix.org/docs/spec/intro.html#room-aliases
> +    let roomIdOrAlias = components.getValue("roomIdOrAlias").trim();
> +    if (roomIdOrAlias.startsWith("!")) {

I'm having trouble following what the code in this if-statement is doing. Can you add a comment?

@@ +828,2 @@
>      }
> +    let domain = this._client.getDomain();

I think we can just inline this below instead of using a separate variable.

@@ +832,3 @@
>      }
>  
> +    if (!roomIdOrAlias.startsWith("@") && !roomIdOrAlias.startsWith("#")) {

I do not believe that @ can be the first character of an alias or room ID.
Attachment #9170440 - Flags: review?(clokep) → feedback+
Attachment #9170440 - Attachment is obsolete: true
Attachment #9170949 - Flags: review?(clokep)
Attachment #9170949 - Attachment is obsolete: true
Attachment #9170949 - Flags: review?(clokep)
Attachment #9171149 - Flags: review?(clokep)

(In reply to Patrick Cloke [:clokep] from comment #3)

@@ +832,3 @@

 }
  • if (!roomIdOrAlias.startsWith("@") && !roomIdOrAlias.startsWith("#")) {

I do not believe that @ can be the first character of an alias or room ID.

I see that you added some comments about this, but I don't see this anywhere in the specification? In fact, when I look at room IDs I see they all start with "!". So where is this idea of it starting with an "@" coming from? I don't see that in the UI of Element or anywhere else.

So how do we add/create rooms for direct conversations? getDirectConversation function creates the direct conversation rooms when we pass the userID. If id is starting with "@", means it's a user ID.

(In reply to Khushil Mistry [:khushil324] from comment #7)

So how do we add/create rooms for direct conversations? getDirectConversation function creates the direct conversation rooms when we pass the userID. If id is starting with "@", means it's a user ID.

So you're not suggesting that this is meant to be a proper ID, but just a way to start a direct conversation with someone (similar to double clicking on their name)?

Yes, right.

Comment on attachment 9171149 [details] [diff] [review]
Bug-1657797_update-join-chat-matrix-2.patch

Review of attachment 9171149 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good! I asked for a couple of comments to be clarified and one block of code to be moved. Let me know if moving it doesn't make sense for some reason!

Sorry for the delay. :)

::: chat/protocols/matrix/matrix.jsm
@@ +816,5 @@
> +    // There will be following types of ids:
> +    // !fubIsJzeAcCcjYTQvm:mozilla.org => General room id.
> +    // #maildev:mozilla.org => Group Conversation room id.
> +    // @clokep:mozilla.org => Direct Conversation room id.
> +    if (roomIdOrAlias.startsWith("!")) {

I think we should be appending the domain before this if statement (so that things like !fubIsJzeAcCcjYTQvm will work).

@@ +838,4 @@
>      }
>  
> +    // If @ or # is not provided in the id, assume it as group conversation
> +    // and append "#".

Please update this to:

> If the ID does not start with @ or #, assume it is a group conversation and append #.

@@ +841,5 @@
> +    // and append "#".
> +    if (!roomIdOrAlias.startsWith("@") && !roomIdOrAlias.startsWith("#")) {
> +      roomIdOrAlias = "#" + roomIdOrAlias;
> +    }
> +    // If it's room-id is of type direct chat, open the direct conversation.

> If the ID starts with a @, it is a direct conversation.

@@ +845,5 @@
> +    // If it's room-id is of type direct chat, open the direct conversation.
> +    if (roomIdOrAlias.startsWith("@")) {
> +      return this.getDirectConversation(roomIdOrAlias);
> +    }
> +    // If it's room-id is of type group chat, open the group conversation.

> Otherwise, it is a group conversation.
Attachment #9171149 - Flags: review?(clokep) → review+
Attachment #9171149 - Attachment is obsolete: true
Attachment #9175695 - Flags: review+
Target Milestone: --- → 82 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/768dcaaaefe9
Update join chat functionality in Matrix. r=clokep DONTBUILD

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

Uplift to 78?

Comment on attachment 9175695 [details] [diff] [review]
Bug-1657797_update-join-chat-matrix-3.patch

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: Matrix Chat experience will be improved.
Testing completed (on c-c, etc.):
Risk to taking this patch (and alternatives if risky): Low

Attachment #9175695 - Flags: approval-comm-esr78?

Comment on attachment 9175695 [details] [diff] [review]
Bug-1657797_update-join-chat-matrix-3.patch

[Triage Comment]
Approved for esr78

Attachment #9175695 - Flags: approval-comm-esr78? → approval-comm-esr78+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: