@@ -2329,65 +2329,67 @@ async fn apply_group_changes(
2329
2329
let mut added_ids = HashSet :: < ContactId > :: new ( ) ;
2330
2330
let mut removed_ids = HashSet :: < ContactId > :: new ( ) ;
2331
2331
2332
- if let Some ( ref chat_group_member_timestamps) = mime_parser. chat_group_member_timestamps ( ) {
2333
- send_event_chat_modified |= update_chats_contacts_timestamps (
2334
- context,
2335
- chat_id,
2336
- Some ( from_id) ,
2337
- to_ids,
2338
- past_ids,
2339
- chat_group_member_timestamps,
2340
- )
2341
- . await ?;
2342
- let new_chat_contacts = HashSet :: < ContactId > :: from_iter (
2343
- chat:: get_chat_contacts ( context, chat_id)
2344
- . await ?
2345
- . iter ( )
2346
- . copied ( ) ,
2347
- ) ;
2348
- added_ids = new_chat_contacts
2349
- . difference ( & chat_contacts)
2350
- . copied ( )
2351
- . collect ( ) ;
2352
- removed_ids = chat_contacts
2353
- . difference ( & new_chat_contacts)
2354
- . copied ( )
2355
- . collect ( ) ;
2356
- } else if is_from_in_chat {
2357
- let mut new_members = HashSet :: from_iter ( to_ids. iter ( ) . copied ( ) ) ;
2358
- new_members. insert ( ContactId :: SELF ) ;
2359
- if !from_id. is_special ( ) {
2360
- new_members. insert ( from_id) ;
2361
- }
2362
-
2363
- if !self_added {
2364
- if mime_parser. get_header ( HeaderDef :: ChatVersion ) . is_none ( ) {
2365
- // Allow non-Delta Chat MUAs to add members.
2366
- added_ids = new_members. difference ( & chat_contacts) . copied ( ) . collect ( ) ;
2367
- }
2368
-
2369
- if let Some ( added_id) = added_id {
2370
- added_ids. insert ( added_id) ;
2371
- }
2372
- new_members. clone_from ( & chat_contacts) ;
2373
- // Don't delete any members locally, but instead add absent ones to provide group
2374
- // membership consistency for all members:
2375
- new_members. extend ( added_ids. clone ( ) ) ;
2376
- }
2377
- if let Some ( removed_id) = removed_id {
2378
- new_members. remove ( & removed_id) ;
2379
- }
2380
-
2381
- if new_members != chat_contacts {
2382
- chat:: update_chat_contacts_table (
2332
+ if is_from_in_chat {
2333
+ if let Some ( ref chat_group_member_timestamps) = mime_parser. chat_group_member_timestamps ( ) {
2334
+ send_event_chat_modified |= update_chats_contacts_timestamps (
2383
2335
context,
2384
- mime_parser. timestamp_sent ,
2385
2336
chat_id,
2386
- & new_members,
2337
+ Some ( from_id) ,
2338
+ to_ids,
2339
+ past_ids,
2340
+ chat_group_member_timestamps,
2387
2341
)
2388
2342
. await ?;
2389
- chat_contacts = new_members;
2390
- send_event_chat_modified = true ;
2343
+ let new_chat_contacts = HashSet :: < ContactId > :: from_iter (
2344
+ chat:: get_chat_contacts ( context, chat_id)
2345
+ . await ?
2346
+ . iter ( )
2347
+ . copied ( ) ,
2348
+ ) ;
2349
+ added_ids = new_chat_contacts
2350
+ . difference ( & chat_contacts)
2351
+ . copied ( )
2352
+ . collect ( ) ;
2353
+ removed_ids = chat_contacts
2354
+ . difference ( & new_chat_contacts)
2355
+ . copied ( )
2356
+ . collect ( ) ;
2357
+ } else {
2358
+ let mut new_members = HashSet :: from_iter ( to_ids. iter ( ) . copied ( ) ) ;
2359
+ new_members. insert ( ContactId :: SELF ) ;
2360
+ if !from_id. is_special ( ) {
2361
+ new_members. insert ( from_id) ;
2362
+ }
2363
+
2364
+ if !self_added {
2365
+ if mime_parser. get_header ( HeaderDef :: ChatVersion ) . is_none ( ) {
2366
+ // Allow non-Delta Chat MUAs to add members.
2367
+ added_ids = new_members. difference ( & chat_contacts) . copied ( ) . collect ( ) ;
2368
+ }
2369
+
2370
+ if let Some ( added_id) = added_id {
2371
+ added_ids. insert ( added_id) ;
2372
+ }
2373
+ new_members. clone_from ( & chat_contacts) ;
2374
+ // Don't delete any members locally, but instead add absent ones to provide group
2375
+ // membership consistency for all members:
2376
+ new_members. extend ( added_ids. clone ( ) ) ;
2377
+ }
2378
+ if let Some ( removed_id) = removed_id {
2379
+ new_members. remove ( & removed_id) ;
2380
+ }
2381
+
2382
+ if new_members != chat_contacts {
2383
+ chat:: update_chat_contacts_table (
2384
+ context,
2385
+ mime_parser. timestamp_sent ,
2386
+ chat_id,
2387
+ & new_members,
2388
+ )
2389
+ . await ?;
2390
+ chat_contacts = new_members;
2391
+ send_event_chat_modified = true ;
2392
+ }
2391
2393
}
2392
2394
}
2393
2395
0 commit comments