Make can_get_channel_message_statistics const to prevent unneeded getChannelFull requests.
GitOrigin-RevId: 90121f149dfa5ec6e586b8932b8507dd25614921
This commit is contained in:
parent
e27385e9b8
commit
d28a7245ea
@ -5974,7 +5974,7 @@ void ContactsManager::send_get_channel_stats_query(DcId dc_id, ChannelId channel
|
||||
}
|
||||
}
|
||||
|
||||
bool ContactsManager::can_get_channel_message_statistics(DialogId dialog_id) {
|
||||
bool ContactsManager::can_get_channel_message_statistics(DialogId dialog_id) const {
|
||||
if (dialog_id.get_type() != DialogType::Channel) {
|
||||
return false;
|
||||
}
|
||||
@ -5985,11 +5985,16 @@ bool ContactsManager::can_get_channel_message_statistics(DialogId dialog_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto channel_full = get_channel_full_force(channel_id, "can_get_channel_message_statistics");
|
||||
if (channel_full == nullptr) {
|
||||
return c->status.is_administrator();
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return false;
|
||||
}
|
||||
return channel_full->stats_dc_id.is_exact();
|
||||
|
||||
auto channel_full = get_channel_full(channel_id);
|
||||
if (channel_full != nullptr) {
|
||||
return channel_full->stats_dc_id.is_exact();
|
||||
}
|
||||
|
||||
return c->status.is_administrator();
|
||||
}
|
||||
|
||||
void ContactsManager::get_channel_message_statistics(FullMessageId full_message_id, bool is_dark,
|
||||
|
@ -371,7 +371,7 @@ class ContactsManager : public Actor {
|
||||
void get_channel_statistics(DialogId dialog_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::ChatStatistics>> &&promise);
|
||||
|
||||
bool can_get_channel_message_statistics(DialogId dialog_id);
|
||||
bool can_get_channel_message_statistics(DialogId dialog_id) const;
|
||||
|
||||
void get_channel_message_statistics(FullMessageId full_message_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise);
|
||||
|
Loading…
Reference in New Issue
Block a user