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,11 +28978,15 @@ 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()) {
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;
if (is_broadcast_channel(dialog_id)) {
message->sender_dialog_id = dialog_id;
} else {
LOG(ERROR) << "Failed to repair sender chat in " << message_id << " in " << dialog_id;
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;
} else {
LOG(ERROR) << "Failed to repair sender chat in " << message_id << " in " << dialog_id;
}
}
}