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(); 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; MessageId prev_last_read_inbox_message_id;
max_thread_message_id = MessageId(); max_thread_message_id = MessageId();
Message *top_m = get_message_force(d, top_thread_message_id, "view_messages 9"); 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(); return Status::OK();
} }
if (source == MessageSource::DialogHistory) { CHECK(source == MessageSource::DialogHistory || force_read);
if (max_message_id > d->last_read_inbox_message_id) { if (max_message_id > d->last_read_inbox_message_id) {
const MessageId last_read_message_id = max_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; const MessageId prev_last_read_inbox_message_id = d->last_read_inbox_message_id;
@ -21786,9 +21789,6 @@ Status MessagesManager::view_messages(DialogId dialog_id, vector<MessageId> mess
return Status::OK(); return Status::OK();
} }
return Status::OK();
}
void MessagesManager::finish_get_message_views(DialogId dialog_id, const vector<MessageId> &message_ids) { void MessagesManager::finish_get_message_views(DialogId dialog_id, const vector<MessageId> &message_ids) {
Dialog *d = get_dialog(dialog_id); Dialog *d = get_dialog(dialog_id);
CHECK(d != nullptr); CHECK(d != nullptr);