Fix add_message_dependencies.

GitOrigin-RevId: 19f6a6f4065a03ddb0517acd97404544bf9edc2b
This commit is contained in:
levlam 2018-04-02 02:03:22 +03:00
parent f63a73b6a6
commit 69c785c3ba
3 changed files with 18 additions and 0 deletions

View File

@ -87,6 +87,10 @@ void Game::set_message_text(FormattedText &&text) {
text_ = std::move(text); text_ = std::move(text);
} }
const FormattedText &Game::get_message_text() const {
return text_;
}
tl_object_ptr<td_api::game> Game::get_game_object(const Td *td) const { tl_object_ptr<td_api::game> Game::get_game_object(const Td *td) const {
return make_tl_object<td_api::game>( return make_tl_object<td_api::game>(
id_, short_name_, title_, get_formatted_text_object(text_), description_, id_, short_name_, title_, get_formatted_text_object(text_), description_,

View File

@ -57,6 +57,8 @@ class Game {
void set_message_text(FormattedText &&text); void set_message_text(FormattedText &&text);
const FormattedText &get_message_text() const;
tl_object_ptr<td_api::game> get_game_object(const Td *td) const; tl_object_ptr<td_api::game> get_game_object(const Td *td) const;
tl_object_ptr<telegram_api::inputMediaGame> get_input_media_game(const Td *td) const; tl_object_ptr<telegram_api::inputMediaGame> get_input_media_game(const Td *td) const;

View File

@ -15340,6 +15340,12 @@ 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();
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:
@ -15425,6 +15431,12 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, Dialo
UNREACHABLE(); UNREACHABLE();
break; break;
} }
auto caption = 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) {