diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index fa3d34e26..f5e0be5e8 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -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; diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 420ec24f7..e189c7d0a 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -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> &&promise, bool from_binlog); diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index 3c6b32c37..bd4ecc6e2 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -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 {