Repait broken entities instead of clearing.

GitOrigin-RevId: 7044b000997b7415f55caa1610c418a76c7ea793
This commit is contained in:
levlam 2020-02-25 01:46:30 +03:00
parent 2ece58302c
commit e14d15196c
5 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,7 @@ unique_ptr<DraftMessage> get_draft_message(ContactsManager *contacts_manager,
if (!clean_input_string(draft->message_)) {
draft->message_.clear();
}
entities.clear();
entities = find_entities(draft->message_, false);
}
result->input_message_text.text = FormattedText{std::move(draft->message_), std::move(entities)};
result->input_message_text.disable_web_page_preview = (flags & telegram_api::draftMessage::NO_WEBPAGE_MASK) != 0;

View File

@ -3088,7 +3088,7 @@ FormattedText get_message_text(const ContactsManager *contacts_manager, string m
if (!clean_input_string(message_text)) {
message_text.clear();
}
entities.clear();
entities = find_entities(message_text, false);
}
return FormattedText{std::move(message_text), std::move(entities)};
}

View File

@ -457,7 +457,7 @@ class GetDeepLinkInfoQuery : public Td::ResultHandler {
if (!clean_input_string(info->message_)) {
info->message_.clear();
}
entities.clear();
entities = find_entities(info->message_, true);
}
FormattedText text{std::move(info->message_), std::move(entities)};
return promise_.set_value(

View File

@ -100,7 +100,7 @@ TermsOfService::TermsOfService(telegram_api::object_ptr<telegram_api::help_terms
if (!clean_input_string(terms->text_)) {
terms->text_.clear();
}
entities.clear();
entities = find_entities(terms->text_, true);
}
if (terms->text_.empty()) {
id_.clear();

View File

@ -748,7 +748,7 @@ int64 WebPagesManager::get_web_page_preview(td_api::object_ptr<td_api::formatted
auto entities = r_entities.move_as_ok();
auto result = fix_formatted_text(text->text_, entities, true, false, true, false);
if (text->text_.empty()) {
if (result.is_error() || text->text_.empty()) {
promise.set_value(Unit());
return 0;
}