alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
508 stars 45 forks source link

Replacement events are inserted into the room based on the replacement timestamp rather the original event's? #253

Open phil-s opened 10 months ago

phil-s commented 10 months ago

I reconnected to my work server this morning, and noticed that an edit I'd made within a series of messages on Friday was out of sequence. I'd written four messages, and afterwards had edited the original message. At the time it was updated in-place; but after disconnecting and reconnecting the edited message was now being displayed as the last of the four messages.

I've been able to reproduce this in further testing, ending up with the likes of:

  2024-01-15 (Monday)

  13:01 

phil:
13:01 two 

phil:
13:01 one (edit) [edited] 

I've tested on matrix.org as well. At first I thought I wasn't seeing the issue on matrix.org, but I suspect I failed to disconnect from that server the first time. After 'repeating' the disconnect/reconnect cycle for both servers, I saw the same/wrong outcome in both. (I mention this mostly in case I still don't understand, and you also can't replicate at first.)

The m.relates_to data in the edit event doesn't include a timestamp, and the :origin-server-ts value is for the edit, so I believe Ement needs to look up the timestamp in the original event (which AFAIR would only ever be a single-step away, as edit events are required to relate to the very first event in the chain).

alphapapa commented 10 months ago

Thanks. This sort of thing has proved to be quite tricky, and the bugs aren't always easy to notice.