Improve error message.

This commit is contained in:
levlam 2021-05-31 20:06:08 +03:00
parent 3860e8eea5
commit 7e61f9c95c
3 changed files with 9 additions and 7 deletions

View File

@ -9479,7 +9479,8 @@ void ContactsManager::on_load_chat_full_from_database(ChatId chat_id, string val
}
if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() !=
td_->file_manager_->get_file_view(as_fake_dialog_photo(chat_full->photo).small_file_id).get_unique_file_id()) {
td_->file_manager_->get_file_view(as_fake_dialog_photo(chat_full->photo, DialogId(chat_id)).small_file_id)
.get_unique_file_id()) {
chat_full->photo = Photo();
if (c->photo.small_file_id.is_valid()) {
reload_chat_full(chat_id, Auto());
@ -9588,7 +9589,8 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
}
if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() !=
td_->file_manager_->get_file_view(as_fake_dialog_photo(channel_full->photo).small_file_id).get_unique_file_id()) {
td_->file_manager_->get_file_view(as_fake_dialog_photo(channel_full->photo, DialogId(channel_id)).small_file_id)
.get_unique_file_id()) {
channel_full->photo = Photo();
if (c->photo.small_file_id.is_valid()) {
channel_full->expires_at = 0.0;
@ -16031,7 +16033,7 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
}
} else {
title = invite_link_info->title;
invite_link_photo = as_fake_dialog_photo(invite_link_info->photo);
invite_link_photo = as_fake_dialog_photo(invite_link_info->photo, dialog_id);
photo = &invite_link_photo;
participant_count = invite_link_info->participant_count;
member_user_ids = get_user_ids_object(invite_link_info->participant_user_ids, "get_chat_invite_link_info_object");

View File

@ -263,7 +263,7 @@ vector<FileId> dialog_photo_get_file_ids(const DialogPhoto &dialog_photo) {
return result;
}
DialogPhoto as_fake_dialog_photo(const Photo &photo) {
DialogPhoto as_fake_dialog_photo(const Photo &photo, DialogId dialog_id) {
DialogPhoto result;
if (!photo.is_empty()) {
for (auto &size : photo.photos) {
@ -276,7 +276,7 @@ DialogPhoto as_fake_dialog_photo(const Photo &photo) {
result.minithumbnail = photo.minithumbnail;
result.has_animation = !photo.animations.empty();
if (!result.small_file_id.is_valid() || !result.big_file_id.is_valid()) {
LOG(ERROR) << "Failed to convert " << photo << " to chat photo";
LOG(ERROR) << "Failed to convert " << photo << " to chat photo of " << dialog_id;
return DialogPhoto();
}
}
@ -285,7 +285,7 @@ DialogPhoto as_fake_dialog_photo(const Photo &photo) {
ProfilePhoto as_profile_photo(FileManager *file_manager, UserId user_id, int64 user_access_hash, const Photo &photo) {
ProfilePhoto result;
static_cast<DialogPhoto &>(result) = as_fake_dialog_photo(photo);
static_cast<DialogPhoto &>(result) = as_fake_dialog_photo(photo, DialogId(user_id));
if (!result.small_file_id.is_valid()) {
return result;
}

View File

@ -96,7 +96,7 @@ DialogPhoto get_dialog_photo(FileManager *file_manager, DialogId dialog_id, int6
tl_object_ptr<td_api::chatPhotoInfo> get_chat_photo_info_object(FileManager *file_manager,
const DialogPhoto *dialog_photo);
DialogPhoto as_fake_dialog_photo(const Photo &photo);
DialogPhoto as_fake_dialog_photo(const Photo &photo, DialogId dialog_id);
ProfilePhoto as_profile_photo(FileManager *file_manager, UserId user_id, int64 user_access_hash, const Photo &photo);