Preload pinned message only for from_update messages to prevent cycles and because only such messages can cause updating of last_new_message_id.

GitOrigin-RevId: 153f8699db19652f142334ef5b3413276892e2cd
This commit is contained in:
levlam 2020-05-31 22:42:58 +03:00
parent 9d7d04e159
commit bffca57da1

View File

@ -28521,7 +28521,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
// in get_message_notification_group_force
get_dialog_notification_group_id(d->dialog_id, get_notification_group_info(d, message.get()));
}
if (*need_update || (!d->last_new_message_id.is_valid() && !message_id.is_yet_unsent())) {
if (*need_update || (!d->last_new_message_id.is_valid() && !message_id.is_yet_unsent() && from_update)) {
auto pinned_message_id = get_message_content_pinned_message_id(message->content.get());
if (pinned_message_id.is_valid() && pinned_message_id < message_id &&
have_message_force({dialog_id, pinned_message_id}, "preload pinned message")) {