Pass ChannelId to can_get_channel_story_statistics.

This commit is contained in:
levlam 2024-03-18 00:03:00 +03:00
parent 95e86d3cf3
commit 649b8cef01
3 changed files with 5 additions and 8 deletions

View File

@ -7004,13 +7004,8 @@ bool ContactsManager::can_get_channel_message_statistics(ChannelId channel_id) c
return c->status.can_post_messages();
}
bool ContactsManager::can_get_channel_story_statistics(DialogId dialog_id) const {
bool ContactsManager::can_get_channel_story_statistics(ChannelId channel_id) const {
CHECK(!td_->auth_manager_->is_bot());
if (dialog_id.get_type() != DialogType::Channel) {
return false;
}
auto channel_id = dialog_id.get_channel_id();
const Channel *c = get_channel(channel_id);
if (c == nullptr || c->is_megagroup) {
return false;

View File

@ -524,7 +524,7 @@ class ContactsManager final : public Actor {
bool can_get_channel_message_statistics(ChannelId channel_id) const;
bool can_get_channel_story_statistics(DialogId dialog_id) const;
bool can_get_channel_story_statistics(ChannelId channel_id) const;
void get_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise,
bool from_binlog);

View File

@ -1843,7 +1843,9 @@ bool StoryManager::can_get_story_statistics(StoryFullId story_full_id, const Sto
if (story == nullptr || !story_full_id.get_story_id().is_server()) {
return false;
}
return td_->contacts_manager_->can_get_channel_story_statistics(story_full_id.get_dialog_id());
auto dialog_id = story_full_id.get_dialog_id();
return dialog_id.get_type() == DialogType::Channel &&
td_->contacts_manager_->can_get_channel_story_statistics(dialog_id.get_channel_id());
}
const StoryManager::ActiveStories *StoryManager::get_active_stories(DialogId owner_dialog_id) const {