Fix add_dialog_dependencies.
GitOrigin-RevId: 070c00847699580432d29ee7ba3c4ff38c468a66
This commit is contained in:
parent
75ea942c82
commit
47611d582e
@ -15663,6 +15663,14 @@ bool MessagesManager::is_message_auto_read(DialogId dialog_id, bool is_outgoing,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessagesManager::add_formatted_text_dependencies(Dependencies &dependencies, const FormattedText &text) {
|
||||||
|
for (auto &entity : text.entities) {
|
||||||
|
if (entity.user_id.is_valid()) {
|
||||||
|
dependencies.user_ids.insert(entity.user_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MessagesManager::add_message_dependencies(Dependencies &dependencies, DialogId dialog_id, const Message *m) {
|
void MessagesManager::add_message_dependencies(Dependencies &dependencies, DialogId dialog_id, const Message *m) {
|
||||||
dependencies.user_ids.insert(m->sender_user_id);
|
dependencies.user_ids.insert(m->sender_user_id);
|
||||||
dependencies.user_ids.insert(m->via_bot_user_id);
|
dependencies.user_ids.insert(m->via_bot_user_id);
|
||||||
@ -15679,11 +15687,7 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, Dialo
|
|||||||
switch (m->content->get_id()) {
|
switch (m->content->get_id()) {
|
||||||
case MessageText::ID: {
|
case MessageText::ID: {
|
||||||
auto content = static_cast<const MessageText *>(m->content.get());
|
auto content = static_cast<const MessageText *>(m->content.get());
|
||||||
for (auto &entity : content->text.entities) {
|
add_formatted_text_dependencies(dependencies, content->text);
|
||||||
if (entity.user_id.is_valid()) {
|
|
||||||
dependencies.user_ids.insert(entity.user_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies.web_page_ids.insert(content->web_page_id);
|
dependencies.web_page_ids.insert(content->web_page_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -15701,12 +15705,7 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, Dialo
|
|||||||
case MessageGame::ID: {
|
case MessageGame::ID: {
|
||||||
auto content = static_cast<const MessageGame *>(m->content.get());
|
auto content = static_cast<const MessageGame *>(m->content.get());
|
||||||
dependencies.user_ids.insert(content->game.get_bot_user_id());
|
dependencies.user_ids.insert(content->game.get_bot_user_id());
|
||||||
const FormattedText &formatted_text = content->game.get_message_text();
|
add_formatted_text_dependencies(dependencies, content->game.get_message_text());
|
||||||
for (auto &entity : formatted_text.entities) {
|
|
||||||
if (entity.user_id.is_valid()) {
|
|
||||||
dependencies.user_ids.insert(entity.user_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageInvoice::ID:
|
case MessageInvoice::ID:
|
||||||
@ -15796,12 +15795,7 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, Dialo
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto caption = get_message_content_caption(m->content.get());
|
add_formatted_text_dependencies(dependencies, get_message_content_caption(m->content.get()));
|
||||||
for (auto &entity : caption.entities) {
|
|
||||||
if (entity.user_id.is_valid()) {
|
|
||||||
dependencies.user_ids.insert(entity.user_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id) {
|
void MessagesManager::add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id) {
|
||||||
@ -24102,6 +24096,9 @@ unique_ptr<MessagesManager::Dialog> MessagesManager::parse_dialog(DialogId dialo
|
|||||||
if (d->messages != nullptr) {
|
if (d->messages != nullptr) {
|
||||||
add_message_dependencies(dependencies, dialog_id, d->messages.get());
|
add_message_dependencies(dependencies, dialog_id, d->messages.get());
|
||||||
}
|
}
|
||||||
|
if (d->draft_message != nullptr) {
|
||||||
|
add_formatted_text_dependencies(dependencies, d->draft_message->input_message_text.text);
|
||||||
|
}
|
||||||
resolve_dependencies_force(dependencies);
|
resolve_dependencies_force(dependencies);
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
|
@ -2581,9 +2581,11 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
static void dump_debug_message_op(const Dialog *d, int priority = 0);
|
static void dump_debug_message_op(const Dialog *d, int priority = 0);
|
||||||
|
|
||||||
void add_message_dependencies(Dependencies &dependencies, DialogId dialog_id, const Message *m);
|
static void add_formatted_text_dependencies(Dependencies &dependencies, const FormattedText &text);
|
||||||
|
|
||||||
void add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id);
|
static void add_message_dependencies(Dependencies &dependencies, DialogId dialog_id, const Message *m);
|
||||||
|
|
||||||
|
static void add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id);
|
||||||
|
|
||||||
void resolve_dependencies_force(const Dependencies &dependencies);
|
void resolve_dependencies_force(const Dependencies &dependencies);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user