Open r10s opened 6 years ago
indirectly, this is already tracked: MAX(msgs.timestamp) WHERE chat.id=...
should always be the modification time of the chat.
We use a similar query when creating the chatlist, so it seems to be fast enough. Maybe this is sufficient.
EDIT: may cause problems when messages are deleted. a separate timestamp in the chats-table is probably more reliable.
However, updates to chat name, members, etc. should only take place if the message with the command is newer than the newest message in the chat - wherever the date comes from.
What if some changes are made while some are offline? Shouldn't a member not be added/removed later?
Or, when the offline person answers to an older message, won't the new answer not override the changes from others that were made in the meantime?
Only asking because I do not yet have a full understanding of what the base rule implies.
offline and delayed messages are no problem, its just that message with the most recent timestamp defines the state. This rule is needed as messages may arrive out of order.
Assume the messages A1 and A2 send from Alice do Bob:
A1 was sent at 01:01 and send the chat title to "my fime group" A2 was sent at 01:02 and corrects the chat title to "my fine group"
Bob, for any reasons, receives A2 first and sets the group title to "my fine group" - when he now receives A1 he must not set bad title again. This can be ensured by tracking the message timestams resp. the timestamps of the last modification.
Autocrypt does the same for its key management, btw, see https://autocrypt.org/level1.html#peers
I see.
Maybe the related https://github.com/deltachat/deltachat-android/issues/211 is relevant, if the problem is not just in the displaying of the time.
nb: the idea is to fix this in core-rust by adding missing members to the memberlist on Chat-Group-Member-Added and removing only explicitly mentioned members on Chat-Group-Member-Removed.
Updates to chat name, members etc. should take only place if newer than the saved timestamp then