Register web page story sender users for UserFromMessage.
This commit is contained in:
parent
e4382ee206
commit
f182e105eb
@ -3301,10 +3301,13 @@ std::pair<InputGroupCallId, bool> get_message_content_group_call_info(const Mess
|
||||
return {m->input_group_call_id, m->duration >= 0};
|
||||
}
|
||||
|
||||
vector<UserId> get_message_content_min_user_ids(const MessageContent *message_content) {
|
||||
vector<UserId> get_message_content_min_user_ids(const Td *td, const MessageContent *message_content) {
|
||||
switch (message_content->get_type()) {
|
||||
case MessageContentType::Text: {
|
||||
// const auto *content = static_cast<const MessageText *>(message_content);
|
||||
const auto *content = static_cast<const MessageText *>(message_content);
|
||||
if (content->web_page_id.is_valid()) {
|
||||
return td->web_pages_manager_->get_web_page_user_ids(content->web_page_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MessageContentType::Animation:
|
||||
|
@ -144,7 +144,7 @@ FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const M
|
||||
|
||||
std::pair<InputGroupCallId, bool> get_message_content_group_call_info(const MessageContent *content);
|
||||
|
||||
vector<UserId> get_message_content_min_user_ids(const MessageContent *message_content);
|
||||
vector<UserId> get_message_content_min_user_ids(const Td *td, const MessageContent *message_content);
|
||||
|
||||
vector<UserId> get_message_content_added_user_ids(const MessageContent *content);
|
||||
|
||||
|
@ -13198,7 +13198,7 @@ int32 MessagesManager::get_message_date(const tl_object_ptr<telegram_api::Messag
|
||||
}
|
||||
}
|
||||
|
||||
vector<UserId> MessagesManager::get_message_user_ids(const Message *m) {
|
||||
vector<UserId> MessagesManager::get_message_user_ids(const Message *m) const {
|
||||
vector<UserId> user_ids;
|
||||
if (m->sender_user_id.is_valid()) {
|
||||
user_ids.push_back(m->sender_user_id);
|
||||
@ -13209,7 +13209,7 @@ vector<UserId> MessagesManager::get_message_user_ids(const Message *m) {
|
||||
if (m->forward_info != nullptr && m->forward_info->sender_user_id.is_valid()) {
|
||||
user_ids.push_back(m->forward_info->sender_user_id);
|
||||
}
|
||||
append(user_ids, get_message_content_min_user_ids(m->content.get()));
|
||||
append(user_ids, get_message_content_min_user_ids(td_, m->content.get()));
|
||||
return user_ids;
|
||||
}
|
||||
|
||||
|
@ -1730,7 +1730,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
static int32 get_message_date(const tl_object_ptr<telegram_api::Message> &message_ptr);
|
||||
|
||||
static vector<UserId> get_message_user_ids(const Message *m);
|
||||
vector<UserId> get_message_user_ids(const Message *m) const;
|
||||
|
||||
static vector<ChannelId> get_message_channel_ids(const Message *m);
|
||||
|
||||
|
@ -1808,6 +1808,20 @@ int32 WebPagesManager::get_web_page_media_duration(const WebPage *web_page) cons
|
||||
return -1;
|
||||
}
|
||||
|
||||
vector<UserId> WebPagesManager::get_web_page_user_ids(WebPageId web_page_id) const {
|
||||
const WebPage *web_page = get_web_page(web_page_id);
|
||||
vector<UserId> user_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::User) {
|
||||
user_ids.push_back(dialog_id.get_user_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
return user_ids;
|
||||
}
|
||||
|
||||
vector<FileId> WebPagesManager::get_web_page_file_ids(const WebPage *web_page) const {
|
||||
if (web_page == nullptr) {
|
||||
return vector<FileId>();
|
||||
|
@ -87,6 +87,8 @@ class WebPagesManager final : public Actor {
|
||||
|
||||
int32 get_web_page_media_duration(WebPageId web_page_id) const;
|
||||
|
||||
vector<UserId> get_web_page_user_ids(WebPageId web_page_id) const;
|
||||
|
||||
void on_story_changed(StoryFullId story_full_id);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user