matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Wrong room list ordering after edit

Open stefanceriu opened this issue 1 year ago • 4 comments

We noticed the room list order break after an edit has been sent in one of the rooms. Notice how the 19:12 room is above everything else in the screenshot below.

The room in question is !TAoweeYCttBnjuMqRg:matrix.org, the original 19:12 event is $c-4G24WDEkdbJYcvO7VDAeMDsdYUS-rntkUIzEjVeak and the subsequent 22:19 edit event is $3cEeTTSRQFcuk8NZBUngz1t4mAbca0boetGQBtQU9aE. There doesn't seem to be anything out of the ordinary about the edit event apart from the time passed in between.

{
  "content": {
    "body": " * [Redacted content..]",
    "m.mentions": {},
    "m.new_content": {
      "body": "[Redacted content..]",
      "format": "org.matrix.custom.html",
      "formatted_body": "[Redacted content..]",
      "m.mentions": {},
      "msgtype": "m.text"
    },
    "m.relates_to": {
      "event_id": "$c-4G24WDEkdbJYcvO7VDAeMDsdYUS-rntkUIzEjVeak",
      "rel_type": "m.replace"
    },
    "msgtype": "m.text"
  },
  "event_id": "$3cEeTTSRQFcuk8NZBUngz1t4mAbca0boetGQBtQU9aE",
  "origin_server_ts": 1734034787585,
  "room_id": "!TAoweeYCttBnjuMqRg:matrix.org",
  "sender": "@redacted:element.io",
  "type": "m.room.message",
  "unsigned": {}
}

7B473857-5046-4950-A1E7-CD1F161B0350

stefanceriu avatar Dec 13 '24 07:12 stefanceriu

The room is encrypted, so the server cannot filter which events trigger a bump. This is the code that handles that:

https://github.com/matrix-org/matrix-rust-sdk/blob/150d9e4b050395bac1981dd57075de645b28c806/crates/matrix-sdk-base/src/sliding_sync/mod.rs#L878-L894

We notice that there is no event filtering whatsoever. We should probably decide which events are candidates to update the recency_stamp.

Hywan avatar Dec 13 '24 08:12 Hywan

Duplicate of https://github.com/matrix-org/matrix-rust-sdk/issues/4062

pixlwave avatar Dec 13 '24 12:12 pixlwave

This must also be why latest messages are sometimes wrong in rooms when rooms when getting decryption keys late / not sharing keys with the NSE(?): the backend bumps them to the top but the app can't yet render the right message.

stefanceriu avatar Dec 13 '24 16:12 stefanceriu

The room is encrypted, so the server cannot filter which events trigger a bump.

In this case that isn't true. The rel_type is unencrypted (otherwise aggregation wouldn't be possible) so a server should be able to ignore events with m.replace relations.

zecakeh avatar Oct 26 '25 10:10 zecakeh