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

Starting a DM with the same user twice results in 2 entries in m.direct. #4730

Open
pixlwave opened this issue Feb 27, 2025 · 0 comments
Open

Comments

@pixlwave
Copy link
Member

pixlwave commented Feb 27, 2025

As reported in the Element X public room, it seems that if you create a DM with someone after having left a DM with them (we don't allow creating 2 DMs with the same user), the m.direct ends up with 2 entires for that user ID. There is then a second issue at play, where if there are 2 entries for the same user ID, the SDK doesn't recognise the new DM as a direct (I haven't dug into what gets decoded).

Reported steps to reproduce:

1.	Both sides cleaned `m.direct`
2.	A starts DM with B
3.	Chat is shown as DM by EX of A and as Room in EX of B
4.	B opens EW in Browser where it is shown as DM and clicks on DM with A
5.	Chat is shown as DM in EX of B
6.	A and B leave room
7.	A starts DM with B
8.	Chat is shown as DM by EX of A and as Room in EX of B
9.	B opens EW in Browser where it is shown as DM and clicks on DM with A
10.   Chat is NOT shown as DM in EX of B

I'm not sure what is going on with 4/5 but I think the important thing here is that by 10 you have two entires in the m.direct.

We're creating DMs with the following:

let parameters = CreateRoomParameters(name: nil,
                                      topic: nil,
                                      isEncrypted: true,
                                      isDirect: true,
                                      visibility: .private,
                                      preset: .trustedPrivateChat,
                                      invite: [userID],
                                      avatar: nil,
                                      powerLevelContentOverride: .init(usersDefault: nil,
                                                                       eventsDefault: nil,
                                                                       stateDefault: nil,
                                                                       ban: nil,
                                                                       kick: nil,
                                                                       redact: nil,
                                                                       invite: nil,
                                                                       notifications: nil,
                                                                       users: [:],
                                                                       events: [
                                                                        "m.call.member": Int32(0),
                                                                        "org.matrix.msc3401.call.member": Int32(0)
                                                                       ]))
let roomID = try await client.createRoom(request: parameters)
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

No branches or pull requests

1 participant