Skip to content

fix: Don't resort re-sent message to the bottom (#8145)#8152

Merged
iequidoo merged 1 commit into
mainfrom
iequidoo/dont-resort-resent-msg
Apr 22, 2026
Merged

fix: Don't resort re-sent message to the bottom (#8145)#8152
iequidoo merged 1 commit into
mainfrom
iequidoo/dont-resort-resent-msg

Conversation

@iequidoo
Copy link
Copy Markdown
Collaborator

@iequidoo iequidoo commented Apr 21, 2026

We shouldn't just revert ad7f873 because then we won't be able to normally transfer a backup from a device having clock a bit in the future.

INDEXED BY msgs_index7 is to prevent SQLite from downgrading to using msgs_index2 which has less ordering.
Fix #8145

Comment thread src/chat.rs
UPDATE msgs SET
timestamp=(
SELECT MAX(timestamp) FROM msgs WHERE
SELECT MAX(timestamp) FROM msgs INDEXED BY msgs_index7 WHERE
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUERY PLAN
|--SEARCH msgs USING INTEGER PRIMARY KEY (rowid=?)
`--SCALAR SUBQUERY 1
   `--SEARCH msgs USING COVERING INDEX msgs_index7 (state=? AND hidden=? AND chat_id=?)

@iequidoo iequidoo marked this pull request as ready for review April 21, 2026 13:49
@iequidoo iequidoo force-pushed the iequidoo/dont-resort-resent-msg branch from 562ca3c to f28fdd5 Compare April 21, 2026 14:59
@iequidoo iequidoo requested review from Hocuri and link2xt April 21, 2026 15:01
Comment thread src/chat/chat_tests.rs
We shouldn't just revert ad7f873 because then we won't be able to
normally transfer a backup from a device having clock a bit in the future.

INDEXED BY msgs_index7 is to prevent SQLite from downgrading to using msgs_index2 which has less
ordering.
@iequidoo iequidoo force-pushed the iequidoo/dont-resort-resent-msg branch from f28fdd5 to a67f269 Compare April 22, 2026 16:44
@iequidoo iequidoo merged commit 38affa2 into main Apr 22, 2026
18 of 19 checks passed
@iequidoo iequidoo deleted the iequidoo/dont-resort-resent-msg branch April 22, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resending a message causes it to be resorted to the bottom

2 participants