deltachat-core
deltachat-core copied to clipboard
[multi device] Messages for ChatView not properly sorted for outgoing self sent messages
I just noticed that I have a chat where i sent someone a message at 14:51 on desktop and the person replied at 14:53. On android-ii my message sent from desktop shows up (nice :D) but is displayed after the message from person. I think this is a core issue, maybe it's internally sorted by the time it's fetched from the inbox or by the order from the inbox instead of the the time the message was sent.
not sure if i got the problem, however, i like to add some information that may clearify some thing. in fact, the timestamp shown beside the messages may not match the sorting order:
- the time stamp is the message sending time
- the message list is sorted by receiving time
This ensures newly received messages always pop up at the end of the list, however, for delayed messages, the correct sending time will be displayed.
This ensures newly received messages always pop up at the end of the list, however, for delayed messages, the correct sending time will be displayed.
How do we know the sending time and can we trust it? Because I think it's weird that messages are shown in different orders depending on the device. The order should be the same on each device, it should feel like it's completely the same and fully synchronized.
How do we know the sending time and can we trust it?
Because I think it's weird that messages are shown in different orders depending on the device.
i agree, and normally, messages are synchronized (just sorted by sending date). we even do "time smearing" (modify the sending time by some seconds so that no two messages have the same time) to keep the message order. and in fact, in the very beginning messages were just always sorted this way iirc.
however, there are downsides with that that are more worse than the different order imo:
- assume a group with some activity, eg. one message arriving per minute.
- if one member sends MESSAGE_X from a flaky message - or just a big message - the message may be easily delayed for quite some time
- in the meanwhile many other messages arrive to the group
- after half an hour or so MESSAGE_X arrives - if this is sorted by sending time, it may be 10 screens above from "now" and will get easily overseen - what is more worse than different orders imo.
again, i just wanted to explain this aspect, still not sure if this is related to the initial issue.
PS: nice screenshots :+1:
after half an hour or so MESSAGE_X arrives - if this is sorted by sending time, it may be 10 screens above from "now" and will get easily overseen - what is more worse than different orders imo.
Yes this would be bad for messages from strangers, but not for messages from myself. You sent them, you should know that you sent them and you're expecting them to show up at the same position across all devices. Just to sync this issue with our talk last night :).
Also want to point out that the behavior for 'stranger messages' is totally right and because it uses the time it arrived in the inbox, it's the same across all devices. This is not the deal between the own device which really sent out the message and other devices which just receive the self send message
.
I agree that it is better to sort messages from others that got delayed due to some transmission problem to the end of the thread. At the same time this issue emphasizes how important it is to always maintain the sorting order of messages if possible (i.e. also with sending delays in control of deltachat itself).
To maintain the same sorting for self-sent messsages, maybe they could be a reasonable and easy to implement exception (these getting sort_timestamp := sent_timestamp) and thus not get sorted to the end of the chat but by their proper sending time. Basic idea: https://github.com/deltachat/deltachat-core/pull/435
After all, syncing is known to always take some time, and in contrast to the communication with others, this delay is not just a occasional problem in groups but a systematic cause for sorting problems whenever one is quickly chatting back and forth.