Repair sender_dialog_id in channel messages.

GitOrigin-RevId: 71cbcb1252798f54da9c40b2c7838ea5f9327683
This commit is contained in:
levlam 2020-09-12 17:55:52 +03:00
parent 80c6f207fb
commit 22265ab338

View File

@ -28978,6 +28978,9 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
MessageId message_id = message->message_id;
if (!has_message_sender_user_id(dialog_id, message.get()) && !message->sender_dialog_id.is_valid()) {
if (is_broadcast_channel(dialog_id)) {
message->sender_dialog_id = dialog_id;
} else {
const auto *forward_info = message->forward_info.get();
if (forward_info != nullptr && forward_info->sender_dialog_id.is_valid() && forward_info->message_id.is_valid()) {
message->sender_dialog_id = forward_info->sender_dialog_id;
@ -28985,6 +28988,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
LOG(ERROR) << "Failed to repair sender chat in " << message_id << " in " << dialog_id;
}
}
}
if (!message_id.is_scheduled() && message_id <= d->last_clear_history_message_id) {
LOG(INFO) << "Skip adding cleared " << message_id << " to " << dialog_id << " from " << source;