Use edit_hide flag to hide 'edited' badge.

This commit is contained in:
John Preston 2019-08-30 18:00:32 +03:00
parent 569340c7d3
commit b27a2cd34a
4 changed files with 8 additions and 16 deletions

View File

@ -80,7 +80,9 @@ int HistoryMessageSigned::maxWidth() const {
} }
void HistoryMessageEdited::refresh(const QString &date, bool displayed) { 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()); text.setText(st::msgDateTextStyle, prefix + date, Ui::NameTextOptions());
} }

View File

@ -118,6 +118,9 @@ public:
[[nodiscard]] bool hasMessageBadge() const { [[nodiscard]] bool hasMessageBadge() const {
return !_messageBadge.isEmpty(); return !_messageBadge.isEmpty();
} }
[[nodiscard]] bool hideEditedBadge() const {
return (_flags & MTPDmessage::Flag::f_edit_hide);
}
void applyGroupAdminChanges( void applyGroupAdminChanges(
const base::flat_set<UserId> &changes) override; const base::flat_set<UserId> &changes) override;

View File

@ -1829,21 +1829,9 @@ bool Message::displayEditedBadge() const {
TimeId Message::displayedEditDate() const { TimeId Message::displayedEditDate() const {
const auto item = message(); const auto item = message();
auto hasViaBotId = item->Has<HistoryMessageVia>(); if (item->hideEditedBadge()) {
auto hasInlineMarkup = (item->inlineReplyMarkup() != nullptr);
return displayedEditDate(hasViaBotId || hasInlineMarkup);
}
TimeId Message::displayedEditDate(
bool hasViaBotOrInlineMarkup) const {
if (hasViaBotOrInlineMarkup) {
return TimeId(0); return TimeId(0);
} else if (const auto fromUser = message()->from()->asUser()) { } else if (const auto edited = displayedEditBadge()) {
if (fromUser->isBot()) {
return TimeId(0);
}
}
if (const auto edited = displayedEditBadge()) {
return edited->date; return edited->date;
} }
return TimeId(0); return TimeId(0);

View File

@ -142,7 +142,6 @@ private:
bool displayFastShare() const; bool displayFastShare() const;
bool displayGoToOriginal() const; bool displayGoToOriginal() const;
ClickHandlerPtr fastReplyLink() const; ClickHandlerPtr fastReplyLink() const;
TimeId displayedEditDate(bool hasViaBotOrInlineMarkup) const;
const HistoryMessageEdited *displayedEditBadge() const; const HistoryMessageEdited *displayedEditBadge() const;
HistoryMessageEdited *displayedEditBadge(); HistoryMessageEdited *displayedEditBadge();
void initTime(); void initTime();