File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1010,25 +1010,24 @@ UPDATE config SET value=? WHERE keyname='configured_addr' AND value!=?1
10101010 && msg. chat_visibility == ChatVisibility :: Archived ;
10111011 updated_chats
10121012 . entry ( msg. chat_id )
1013- . and_modify ( |ts | * ts = cmp:: max ( * ts , msg. timestamp_sort ) )
1014- . or_insert ( msg. timestamp_sort ) ;
1013+ . and_modify ( |pos | * pos = cmp:: max ( * pos , ( msg. timestamp_sort , msg . id ) ) )
1014+ . or_insert ( ( msg. timestamp_sort , msg . id ) ) ;
10151015 }
10161016 }
1017- for ( chat_id, timestamp_sort) in updated_chats {
1017+ for ( chat_id, ( timestamp_sort, msg_id ) ) in updated_chats {
10181018 context
10191019 . sql
10201020 . execute (
10211021 "
10221022UPDATE msgs SET state=? WHERE
1023- state=? AND
1024- hidden=0 AND
1025- chat_id=? AND
1026- timestamp<?" ,
1023+ state=?2 AND hidden=0 AND chat_id=?3 AND timestamp<?4 OR
1024+ state=?2 AND hidden=0 AND chat_id=?3 AND timestamp=?4 AND id<?5" ,
10271025 (
10281026 MessageState :: InNoticed ,
10291027 MessageState :: InFresh ,
10301028 chat_id,
10311029 timestamp_sort,
1030+ msg_id,
10321031 ) ,
10331032 )
10341033 . await
You can’t perform that action at this time.
0 commit comments