From 7c940a0480bd28b66e522ffb808109742afb9758 Mon Sep 17 00:00:00 2001 From: AlexeyZavar Date: Sun, 9 Mar 2025 01:28:07 +0300 Subject: [PATCH] fix: ttl messages hint --- Telegram/SourceFiles/history/history_item.cpp | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index c30243890..d0253457d 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -3095,7 +3095,12 @@ void HistoryItem::setDeleted() { _deleted = true; const auto settings = &AyuSettings::getInstance(); - setAyuHint(settings->deletedMark); + if (settings->replaceBottomInfoWithIcons) { + history()->owner().requestItemViewRefresh(this); + history()->owner().requestItemResize(this); + } else { + setAyuHint(settings->deletedMark); + } } bool HistoryItem::isDeleted() const { @@ -3104,7 +3109,32 @@ bool HistoryItem::isDeleted() const { void HistoryItem::setAyuHint(const QString &hint) { try { - if (isService() && !_text.empty()) { + auto msgsigned = Get(); + if (hint.isEmpty()) { + if (!msgsigned) { + return; + } + RemoveComponents(HistoryMessageSigned::Bit()); + history()->owner().requestItemViewRefresh(this); + history()->owner().requestItemResize(this); + return; + } + + if (!isService()) { + if (!(_flags & MessageFlag::HasPostAuthor)) { + _flags |= MessageFlag::HasPostAuthor; + } + + if (!msgsigned) { + AddComponents(HistoryMessageSigned::Bit()); + msgsigned = Get(); + } else if (msgsigned->author == hint) { + return; + } + msgsigned->author = hint; + msgsigned->isAnonymousRank = !isDiscussionPost() + && this->author()->isMegagroup(); + } else if (/* isService() && */!_text.empty()) { const auto data = Get(); const auto postfix = QString(" (%1)").arg(hint); if (!_text.text.endsWith(postfix)) { // fix stacking for TTL messages @@ -3114,6 +3144,8 @@ void HistoryItem::setAyuHint(const QString &hint) { }; setServiceText(std::move(prepared)); } + } else { + return; } // update bottom info