2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-03 16:05:57 +00:00

Generate previews for cloud theme links.

This commit is contained in:
John Preston
2019-09-09 14:56:05 +03:00
parent 6d29dc3b36
commit ee5423762a
20 changed files with 193 additions and 80 deletions

View File

@@ -2762,6 +2762,17 @@ void Session::webpageApplyFields(
const auto pendingTill = TimeId(0);
const auto photo = data.vphoto();
const auto document = data.vdocument();
const auto lookupThemeDocument = [&]() -> DocumentData* {
if (const auto documents = data.vdocuments()) {
for (const auto &document : documents->v) {
const auto processed = processDocument(document);
if (processed->isTheme()) {
return processed;
}
}
}
return nullptr;
};
webpageApplyFields(
page,
ParseWebPageType(data),
@@ -2771,7 +2782,7 @@ void Session::webpageApplyFields(
qs(data.vtitle().value_or_empty()),
description,
photo ? processPhoto(*photo).get() : nullptr,
document ? processDocument(*document).get() : nullptr,
document ? processDocument(*document).get() : lookupThemeDocument(),
WebPageCollage(data),
data.vduration().value_or_empty(),
qs(data.vauthor().value_or_empty()),