From aa515c895bc10933c1902ce23bd224e680f39642 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 22 May 2020 15:38:46 +0300 Subject: [PATCH] Hide view count for failed to send messages. GitOrigin-RevId: 7450f2f80cf943d013f5da41101d0f85ee00e1fa --- td/telegram/MessagesManager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index da1eef07a..33a418f99 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -18048,12 +18048,13 @@ tl_object_ptr MessagesManager::get_message_object(DialogId dial auto live_location_date = m->is_failed_to_send ? 0 : m->date; auto date = is_scheduled ? 0 : m->date; auto edit_date = m->hide_edit_date ? 0 : m->edit_date; + auto views = m->message_id.is_scheduled() || m->message_id.is_local() ? 0 : m->views; return make_tl_object( m->message_id.get(), td_->contacts_manager_->get_user_id_object(m->sender_user_id, "sender_user_id"), dialog_id.get(), std::move(sending_state), std::move(scheduling_state), is_outgoing, can_be_edited, can_be_forwarded, can_delete_for_self, can_delete_for_all_users, m->is_channel_post, contains_unread_mention, date, edit_date, get_message_forward_info_object(m->forward_info), reply_to_message_id, ttl, ttl_expires_in, - td_->contacts_manager_->get_user_id_object(m->via_bot_user_id, "via_bot_user_id"), m->author_signature, m->views, + td_->contacts_manager_->get_user_id_object(m->via_bot_user_id, "via_bot_user_id"), m->author_signature, views, media_album_id, get_restriction_reason_description(m->restriction_reasons), get_message_content_object(m->content.get(), td_, live_location_date, m->is_content_secret), get_reply_markup_object(m->reply_markup)); @@ -23810,6 +23811,9 @@ void MessagesManager::fail_send_message(FullMessageId full_message_id, int error } else { CHECK(message->message_id.is_valid()); } + if (message->forward_info == nullptr && message->views == 1) { + message->views = 0; + } message->is_failed_to_send = true; message->send_error_code = error_code; message->send_error_message = error_message;