mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
Re-index a sent message only when its thread moves
Task: 2026/08/18/repair-shared-media-index-and-count-bookkeeping
This commit is contained in:
@@ -2656,9 +2656,9 @@ void HistoryItem::applySentMessage(const MTPDmessage &data) {
|
||||
_flags &= ~MessageFlag::InvertMedia;
|
||||
}
|
||||
|
||||
if (!isLocalUpdateMedia()) {
|
||||
removeFromSharedMediaIndex();
|
||||
}
|
||||
const auto wasTypes = sharedMediaTypes();
|
||||
const auto wasTopicRootId = topicRootId();
|
||||
const auto wasSublistPeerId = sublistPeerId();
|
||||
updateSentContent(data);
|
||||
updateReplyMarkup(HistoryMessageMarkupData(data.vreply_markup()));
|
||||
updateForwardedInfo(data.vfwd_from());
|
||||
@@ -2690,6 +2690,19 @@ void HistoryItem::applySentMessage(const MTPDmessage &data) {
|
||||
}
|
||||
setPostAuthor(data.vpost_author().value_or_empty());
|
||||
contributeToSlowmode(data.vdate().v);
|
||||
if (isRegular()
|
||||
&& !isLocalUpdateMedia()
|
||||
&& (topicRootId() != wasTopicRootId
|
||||
|| sublistPeerId() != wasSublistPeerId)) {
|
||||
if (wasTypes) {
|
||||
_history->session().storage().remove(Storage::SharedMediaRemoveOne(
|
||||
_history->peer->id,
|
||||
wasTopicRootId,
|
||||
wasSublistPeerId,
|
||||
wasTypes,
|
||||
id));
|
||||
}
|
||||
}
|
||||
addToSharedMediaIndex();
|
||||
setIsPinned(data.is_pinned());
|
||||
addToMessagesIndex();
|
||||
|
||||
Reference in New Issue
Block a user