Fix viewMessages.force_read.

This commit is contained in:
levlam 2023-03-05 15:49:08 +03:00
parent c983eb6eab
commit 31be0a5be8

View File

@ -21707,7 +21707,10 @@ Status MessagesManager::view_messages(DialogId dialog_id, vector<MessageId> mess
return Status::OK();
}
if (source == MessageSource::MessageThreadHistory && top_thread_message_id.is_valid() && max_message_id.is_valid()) {
if (source == MessageSource::MessageThreadHistory) {
if (!top_thread_message_id.is_valid() || !max_message_id.is_valid()) {
return Status::OK();
}
MessageId prev_last_read_inbox_message_id;
max_thread_message_id = MessageId();
Message *top_m = get_message_force(d, top_thread_message_id, "view_messages 9");
@ -21753,7 +21756,7 @@ Status MessagesManager::view_messages(DialogId dialog_id, vector<MessageId> mess
return Status::OK();
}
if (source == MessageSource::DialogHistory) {
CHECK(source == MessageSource::DialogHistory || force_read);
if (max_message_id > d->last_read_inbox_message_id) {
const MessageId last_read_message_id = max_message_id;
const MessageId prev_last_read_inbox_message_id = d->last_read_inbox_message_id;
@ -21783,9 +21786,6 @@ Status MessagesManager::view_messages(DialogId dialog_id, vector<MessageId> mess
if (d->is_marked_as_unread) {
set_dialog_is_marked_as_unread(d, false);
}
return Status::OK();
}
return Status::OK();
}