@@ -484,7 +484,6 @@ impl MessageBox {
484
484
// It mutates the local pts state, remembers possible gaps, builds a set of entries for
485
485
// which the deadlines should be reset, and determines whether any local pts was changed
486
486
// so that the seq can be updated too (which could otherwise have been done earlier).
487
- let mut any_pts_applied = false ;
488
487
let mut reset_deadlines_for = mem:: take ( & mut self . tmp_entries ) ;
489
488
for update in updates {
490
489
let ( entry, update) = self . apply_pts_info ( update) ;
@@ -496,29 +495,12 @@ impl MessageBox {
496
495
}
497
496
if let Some ( update) = update {
498
497
result. push ( update) ;
499
- any_pts_applied |= entry. is_some ( ) ;
500
498
}
501
499
}
502
500
self . reset_deadlines ( & reset_deadlines_for, next_updates_deadline ( ) ) ;
503
501
reset_deadlines_for. clear ( ) ;
504
502
self . tmp_entries = reset_deadlines_for;
505
503
506
- // > If the updates were applied, local *Updates* state must be updated
507
- // > with `seq` (unless it's 0) and `date` from the constructor.
508
- //
509
- // By "were applied", we assume it means "some other pts was applied".
510
- // Updates which can be applied in any order, such as `UpdateChat`,
511
- // should not cause `seq` to be updated (or upcoming updates such as
512
- // `UpdateChatParticipant` could be missed).
513
- if any_pts_applied {
514
- if date != NO_DATE {
515
- self . date = date;
516
- }
517
- if seq != NO_SEQ {
518
- self . seq = seq;
519
- }
520
- }
521
-
522
504
if !self . possible_gaps . is_empty ( ) {
523
505
// For each update in possible gaps, see if the gap has been resolved already.
524
506
let keys = self . possible_gaps . keys ( ) . copied ( ) . collect :: < Vec < _ > > ( ) ;
@@ -546,6 +528,17 @@ impl MessageBox {
546
528
}
547
529
}
548
530
531
+ if !result. is_empty ( ) && self . possible_gaps . is_empty ( ) {
532
+ // > If the updates were applied, local *Updates* state must be updated
533
+ // > with `seq` (unless it's 0) and `date` from the constructor.
534
+ if date != NO_DATE {
535
+ self . date = date;
536
+ }
537
+ if seq != NO_SEQ {
538
+ self . seq = seq;
539
+ }
540
+ }
541
+
549
542
Ok ( ( result, users, chats) )
550
543
}
551
544
0 commit comments