@@ -3588,10 +3588,10 @@ pub(crate) async fn create_broadcast_list_ex(
3588
3588
/// Set chat contacts in the `chats_contacts` table.
3589
3589
pub ( crate ) async fn update_chat_contacts_table (
3590
3590
context : & Context ,
3591
+ timestamp : i64 ,
3591
3592
id : ChatId ,
3592
3593
contacts : & HashSet < ContactId > ,
3593
3594
) -> Result < ( ) > {
3594
- let now = time ( ) ;
3595
3595
context
3596
3596
. sql
3597
3597
. transaction ( move |transaction| {
@@ -3600,21 +3600,21 @@ pub(crate) async fn update_chat_contacts_table(
3600
3600
// We add members from `contacts` back below.
3601
3601
transaction. execute (
3602
3602
"UPDATE chats_contacts
3603
- SET remove_timestamp=MAX(add_timestamp+1, ?)
3604
- WHERE chat_id=?" ,
3605
- ( now , id) ,
3603
+ SET remove_timestamp=MAX(add_timestamp+1, ?)
3604
+ WHERE chat_id=?" ,
3605
+ ( timestamp , id) ,
3606
3606
) ?;
3607
3607
3608
3608
for contact_id in contacts {
3609
3609
// We bumped `add_timestamp` for existing rows above,
3610
3610
// so on conflict it is enough to set `add_timestamp = remove_timestamp`
3611
- // and this guarantees that `add_timestamp` is no less than `now `.
3611
+ // and this guarantees that `add_timestamp` is no less than `timestamp `.
3612
3612
transaction. execute (
3613
3613
"INSERT INTO chats_contacts (chat_id, contact_id, add_timestamp)
3614
3614
VALUES (?1, ?2, ?3)
3615
3615
ON CONFLICT (chat_id, contact_id)
3616
3616
DO UPDATE SET add_timestamp=remove_timestamp" ,
3617
- ( id, contact_id, now ) ,
3617
+ ( id, contact_id, timestamp ) ,
3618
3618
) ?;
3619
3619
}
3620
3620
Ok ( ( ) )
@@ -4578,7 +4578,7 @@ async fn set_contacts_by_addrs(context: &Context, id: ChatId, addrs: &[String])
4578
4578
if contacts == contacts_old {
4579
4579
return Ok ( ( ) ) ;
4580
4580
}
4581
- update_chat_contacts_table ( context, id, & contacts) . await ?;
4581
+ update_chat_contacts_table ( context, time ( ) , id, & contacts) . await ?;
4582
4582
context. emit_event ( EventType :: ChatModified ( id) ) ;
4583
4583
Ok ( ( ) )
4584
4584
}
0 commit comments