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

Wrong room list ordering after edit #4413

Open
stefanceriu opened this issue Dec 13, 2024 · 3 comments
Open

Wrong room list ordering after edit #4413

stefanceriu opened this issue Dec 13, 2024 · 3 comments
Assignees

Comments

@stefanceriu
Copy link
Member

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

@Hywan
Copy link
Member

Hywan commented Dec 13, 2024

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

if let Some(recency_stamp) = &room_data.bump_stamp {
let recency_stamp: u64 = (*recency_stamp).into();
if room_info.recency_stamp.as_ref() != Some(&recency_stamp) {
room_info.update_recency_stamp(recency_stamp);
// If it's not a new room, let's emit a `RECENCY_STAMP` update.
// For a new room, the room will appear as new, so we don't care about this
// update.
if !is_new_room {
room_info_notable_updates
.entry(room_id.to_owned())
.or_default()
.insert(RoomInfoNotableUpdateReasons::RECENCY_STAMP);
}
}
}

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

@pixlwave
Copy link
Member

Duplicate of #4062

@pixlwave pixlwave marked this as a duplicate of #4062 Dec 13, 2024
@stefanceriu
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants