@@ -3097,7 +3097,7 @@ void QuickReplyManager::update_shortcut_from(Shortcut *new_shortcut, Shortcut *o
30973097 }
30983098 }
30993099 if (it == old_shortcut->messages_ .end () || (*it)->message_id != new_first_message_id) {
3100- register_new_message (new_shortcut->messages_ [0 ].get (), " update_shortcut_from" );
3100+ register_new_message (new_shortcut->messages_ [0 ].get (), " update_shortcut_from 1 " );
31013101 old_shortcut->messages_ .insert (it, std::move (new_shortcut->messages_ [0 ]));
31023102 } else {
31033103 update_quick_reply_message (*it, std::move (new_shortcut->messages_ [0 ]));
@@ -3123,16 +3123,19 @@ void QuickReplyManager::update_shortcut_from(Shortcut *new_shortcut, Shortcut *o
31233123 new_shortcut->messages_ = std::move (old_shortcut->messages_ );
31243124 } else {
31253125 *are_messages_changed = true ;
3126+ FlatHashSet<MessageId, MessageIdHash> old_message_ids;
31263127 for (auto &old_message : old_shortcut->messages_ ) {
31273128 CHECK (old_message != nullptr );
31283129 if (!old_message->message_id .is_server ()) {
31293130 new_shortcut->messages_ .push_back (std::move (old_message));
3131+ new_shortcut->local_total_count_ ++;
31303132 } else {
31313133 bool is_deleted = true ;
31323134 for (auto &new_message : new_shortcut->messages_ ) {
31333135 if (new_message->message_id == old_message->message_id ) {
31343136 update_quick_reply_message (old_message, std::move (new_message));
31353137 new_message = std::move (old_message);
3138+ old_message_ids.insert (new_message->message_id );
31363139 is_deleted = false ;
31373140 break ;
31383141 }
@@ -3142,6 +3145,11 @@ void QuickReplyManager::update_shortcut_from(Shortcut *new_shortcut, Shortcut *o
31423145 }
31433146 }
31443147 }
3148+ for (auto &message : new_shortcut->messages_ ) {
3149+ if (message->message_id .is_server () && old_message_ids.count (message->message_id ) == 0 ) {
3150+ register_new_message (message.get (), " update_shortcut_from 2" );
3151+ }
3152+ }
31453153 sort_quick_reply_messages (new_shortcut->messages_ );
31463154 }
31473155 }
0 commit comments