Add and use WebPagesManager::get_web_page_channel_ids.
This commit is contained in:
parent
5b9731a974
commit
d8430c5681
@ -3769,6 +3769,13 @@ vector<UserId> get_message_content_min_user_ids(const Td *td, const MessageConte
|
||||
vector<ChannelId> get_message_content_min_channel_ids(const Td *td, const MessageContent *message_content) {
|
||||
CHECK(message_content != nullptr);
|
||||
switch (message_content->get_type()) {
|
||||
case MessageContentType::Text: {
|
||||
const auto *content = static_cast<const MessageText *>(message_content);
|
||||
if (content->web_page_id.is_valid()) {
|
||||
return td->web_pages_manager_->get_web_page_channel_ids(content->web_page_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MessageContentType::ProximityAlertTriggered:
|
||||
// not supported server-side
|
||||
break;
|
||||
|
@ -1866,6 +1866,20 @@ vector<UserId> WebPagesManager::get_web_page_user_ids(WebPageId web_page_id) con
|
||||
return user_ids;
|
||||
}
|
||||
|
||||
vector<ChannelId> WebPagesManager::get_web_page_channel_ids(WebPageId web_page_id) const {
|
||||
const WebPage *web_page = get_web_page(web_page_id);
|
||||
vector<ChannelId> channel_ids;
|
||||
if (web_page != nullptr && !web_page->story_full_ids_.empty()) {
|
||||
for (auto story_full_id : web_page->story_full_ids_) {
|
||||
auto dialog_id = story_full_id.get_dialog_id();
|
||||
if (dialog_id.get_type() == DialogType::Channel) {
|
||||
channel_ids.push_back(dialog_id.get_channel_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
return channel_ids;
|
||||
}
|
||||
|
||||
vector<FileId> WebPagesManager::get_web_page_file_ids(const WebPage *web_page) const {
|
||||
if (web_page == nullptr) {
|
||||
return vector<FileId>();
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/ChannelId.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
@ -96,6 +97,8 @@ class WebPagesManager final : public Actor {
|
||||
|
||||
vector<UserId> get_web_page_user_ids(WebPageId web_page_id) const;
|
||||
|
||||
vector<ChannelId> get_web_page_channel_ids(WebPageId web_page_id) const;
|
||||
|
||||
void on_story_changed(StoryFullId story_full_id);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user