From 7dc1aed0d240adc14b0a2456b643b96a9fdc48df Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 25 Sep 2023 21:23:14 +0300 Subject: [PATCH] Use can_get_message_statistics in send_get_message_public_forwards_query. --- td/telegram/MessagesManager.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 1a266bb1824e..279c9d8eb974 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -24010,19 +24010,7 @@ void MessagesManager::get_message_public_forwards(MessageFullId message_full_id, void MessagesManager::send_get_message_public_forwards_query( DcId dc_id, MessageFullId message_full_id, string offset, int32 limit, Promise> &&promise) { - auto dialog_id = message_full_id.get_dialog_id(); - Dialog *d = get_dialog_force(dialog_id, "send_get_message_public_forwards_query"); - if (d == nullptr) { - return promise.set_error(Status::Error(400, "Chat not found")); - } - - const Message *m = get_message_force(d, message_full_id.get_message_id(), "send_get_message_public_forwards_query"); - if (m == nullptr) { - return promise.set_error(Status::Error(400, "Message not found")); - } - - if (m->view_count == 0 || m->forward_info != nullptr || m->had_forward_info || m->message_id.is_scheduled() || - !m->message_id.is_server()) { + if (!can_get_message_statistics(message_full_id)) { return promise.set_error(Status::Error(400, "Message forwards are inaccessible")); }