Fix stale mention / reaction badges.

This commit is contained in:
John Preston 2023-08-17 10:04:56 +02:00
parent 3aebf59a61
commit e4811505c8
2 changed files with 10 additions and 3 deletions

View File

@ -1522,7 +1522,7 @@ void HistoryItem::applyEdition(HistoryMessageEdition &&edition) {
setText(std::move(updatedText));
}
if (!isLocalUpdateMedia() && !updatingSavedLocalEdit) {
indexAsNewItem();
addToSharedMediaIndex();
}
if (!edition.useSameReplies) {
if (!edition.replies.isNull) {
@ -1633,7 +1633,7 @@ void HistoryItem::applySentMessage(const MTPDmessage &data) {
setPostAuthor(data.vpost_author().value_or_empty());
setIsPinned(data.is_pinned());
contributeToSlowmode(data.vdate().v);
indexAsNewItem();
addToSharedMediaIndex();
invalidateChatListEntry();
if (const auto period = data.vttl_period(); period && period->v > 0) {
applyTTL(data.vdate().v + period->v);
@ -1657,7 +1657,7 @@ void HistoryItem::applySentMessage(
}, data.vmedia());
contributeToSlowmode(data.vdate().v);
if (!wasAlready) {
indexAsNewItem();
addToSharedMediaIndex();
}
invalidateChatListEntry();
if (const auto period = data.vttl_period(); period && period->v > 0) {
@ -1819,6 +1819,12 @@ Storage::SharedMediaTypesMask HistoryItem::sharedMediaTypes() const {
void HistoryItem::indexAsNewItem() {
if (isRegular()) {
addToUnreadThings(HistoryUnreadThings::AddType::New);
}
addToSharedMediaIndex();
}
void HistoryItem::addToSharedMediaIndex() {
if (isRegular()) {
if (const auto types = sharedMediaTypes()) {
_history->session().storage().add(Storage::SharedMediaAddNew(
_history->peer->id,

View File

@ -359,6 +359,7 @@ public:
[[nodiscard]] Storage::SharedMediaTypesMask sharedMediaTypes() const;
void indexAsNewItem();
void addToSharedMediaIndex();
void removeFromSharedMediaIndex();
struct NotificationTextOptions {