Wrong room list ordering after edit
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": {}
}
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.
Duplicate of https://github.com/matrix-org/matrix-rust-sdk/issues/4062
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.
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.