matrix-org / matrix-org/matrix-js-sdk

Automatically add to account_data "m.direct" direct rooms members

Open
#2,672 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-Enhancement
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

To create a direct message room we need to call

client.createRoom({ 
   is_direct: true, 
   invite: [userId], 
   visibility: "private" 
})

This creates the room, but as per the matrix spec:

Both the inviting client and the invitee’s client should record the fact that the room is a direct chat by storing an m.direct event in the account data using /user/<user_id>/account_data/.

As far as I can tell, this isn't done automatically by matrix-js-sdk.

Manual management is impossible for servers that configure auto-joining on invites. Without m.direct update, it's impossible to tell which rooms are DM rooms. This might mean that this is a Bug report rather than a Feature request.

Describe the solution you'd like

When a user joins a DM room (one that was created with the above options), matrix-js-sdk should make sure the m.direct account data is correctly set as per the matrix docs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the client.createRoom entry point and the room-join path, then review the m.direct account-data endpoints described in the issue. Done means direct rooms created with the shown options have the correct m.direct account data after the user joins.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.