diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index 26ffcf0e5c..48610e6ba9 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -80,7 +80,9 @@ int HistoryMessageSigned::maxWidth() const { } void HistoryMessageEdited::refresh(const QString &date, bool displayed) { - const auto prefix = displayed ? (tr::lng_edited(tr::now) + ' ') : QString(); + const auto prefix = displayed + ? (tr::lng_edited(tr::now) + ' ') + : QString(); text.setText(st::msgDateTextStyle, prefix + date, Ui::NameTextOptions()); } diff --git a/Telegram/SourceFiles/history/history_message.h b/Telegram/SourceFiles/history/history_message.h index d724723c02..c9904c1606 100644 --- a/Telegram/SourceFiles/history/history_message.h +++ b/Telegram/SourceFiles/history/history_message.h @@ -118,6 +118,9 @@ public: [[nodiscard]] bool hasMessageBadge() const { return !_messageBadge.isEmpty(); } + [[nodiscard]] bool hideEditedBadge() const { + return (_flags & MTPDmessage::Flag::f_edit_hide); + } void applyGroupAdminChanges( const base::flat_set &changes) override; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index aa0c29c894..9a294479b3 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1829,21 +1829,9 @@ bool Message::displayEditedBadge() const { TimeId Message::displayedEditDate() const { const auto item = message(); - auto hasViaBotId = item->Has(); - auto hasInlineMarkup = (item->inlineReplyMarkup() != nullptr); - return displayedEditDate(hasViaBotId || hasInlineMarkup); -} - -TimeId Message::displayedEditDate( - bool hasViaBotOrInlineMarkup) const { - if (hasViaBotOrInlineMarkup) { + if (item->hideEditedBadge()) { return TimeId(0); - } else if (const auto fromUser = message()->from()->asUser()) { - if (fromUser->isBot()) { - return TimeId(0); - } - } - if (const auto edited = displayedEditBadge()) { + } else if (const auto edited = displayedEditBadge()) { return edited->date; } return TimeId(0); diff --git a/Telegram/SourceFiles/history/view/history_view_message.h b/Telegram/SourceFiles/history/view/history_view_message.h index a7290ab7d4..149b7db300 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.h +++ b/Telegram/SourceFiles/history/view/history_view_message.h @@ -142,7 +142,6 @@ private: bool displayFastShare() const; bool displayGoToOriginal() const; ClickHandlerPtr fastReplyLink() const; - TimeId displayedEditDate(bool hasViaBotOrInlineMarkup) const; const HistoryMessageEdited *displayedEditBadge() const; HistoryMessageEdited *displayedEditBadge(); void initTime();