From 1038baf4677bfe65d7f877f33a552a496b12e89a Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 10 Oct 2024 11:34:46 +0400 Subject: [PATCH] Allow timestamp links under spoilers. --- .../history/view/media/history_view_media.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_media.cpp b/Telegram/SourceFiles/history/view/media/history_view_media.cpp index 2fc9774028..d41c93febe 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media.cpp @@ -156,17 +156,23 @@ TextWithEntities AddTimestampLinks( } auto &entities = text.entities; - const auto i = ranges::lower_bound( + auto i = ranges::lower_bound( entities, from, std::less<>(), &EntityInText::offset); + while (i != entities.end() + && i->offset() < till + && i->type() == EntityType::Spoiler) { + ++i; + } if (i != entities.end() && i->offset() < till) { continue; } const auto intersects = [&](const EntityInText &entity) { - return entity.offset() + entity.length() > from; + return (entity.offset() + entity.length() > from) + && (entity.type() != EntityType::Spoiler); }; auto j = std::make_reverse_iterator(i); const auto e = std::make_reverse_iterator(entities.begin());