Add anchor to referenced texts.

GitOrigin-RevId: 035ed463fc05184e8ff1df1dd9460cd894569c9c
This commit is contained in:
levlam 2020-03-04 16:38:22 +03:00
parent 5e2ad0a814
commit afde9cf6b8

View File

@ -158,14 +158,18 @@ class RichText {
return make_tl_object<td_api::richTextIcon>(
context->td_->documents_manager_->get_document_object(document_file_id), width, height);
}
case RichText::Type::Anchor:
case RichText::Type::Anchor: {
if (context->is_first_pass_) {
context->anchors_.emplace(Slice(content), texts[0].empty() ? nullptr : &texts[0]);
}
if (texts[0].empty()) {
return make_tl_object<td_api::richTextAnchor>(content);
}
return texts[0].get_rich_text_object(context);
auto result = make_tl_object<td_api::richTexts>();
result->texts_.push_back(make_tl_object<td_api::richTextAnchor>(content));
result->texts_.push_back(texts[0].get_rich_text_object(context));
return std::move(result);
}
}
UNREACHABLE();
return nullptr;