mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fix crash on "History cleared" delete in Saved Messages.
This commit is contained in:
parent
9d0457d208
commit
b8ce79467f
1 changed files with 13 additions and 0 deletions
|
@ -1698,6 +1698,7 @@ void HistoryItem::setStoryFields(not_null<Data::Story*> story) {
|
|||
}
|
||||
|
||||
void HistoryItem::applyEdition(const MTPDmessageService &message) {
|
||||
const auto wasSublist = savedSublist();
|
||||
if (message.vaction().type() == mtpc_messageActionHistoryClear) {
|
||||
const auto wasGrouped = history()->owner().groups().isGrouped(this);
|
||||
setReplyMarkup({});
|
||||
|
@ -1729,6 +1730,11 @@ void HistoryItem::applyEdition(const MTPDmessageService &message) {
|
|||
finishEdition(-1);
|
||||
_flags &= ~MessageFlag::DisplayFromChecked;
|
||||
}
|
||||
const auto nowSublist = savedSublist();
|
||||
if (wasSublist && nowSublist != wasSublist) {
|
||||
wasSublist->removeOne(this);
|
||||
nowSublist->applyMaybeLast(this);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryItem::applyEdition(const MTPMessageExtendedMedia &media) {
|
||||
|
@ -3097,6 +3103,13 @@ bool HistoryItem::isEmpty() const {
|
|||
Data::SavedSublist *HistoryItem::savedSublist() const {
|
||||
if (const auto saved = Get<HistoryMessageSaved>()) {
|
||||
return saved->sublist;
|
||||
} else if (_history->peer->isSelf()) {
|
||||
const auto sublist = _history->owner().savedMessages().sublist(
|
||||
_history->peer);
|
||||
const auto that = const_cast<HistoryItem*>(this);
|
||||
that->AddComponents(HistoryMessageSaved::Bit());
|
||||
that->Get<HistoryMessageSaved>()->sublist = sublist;
|
||||
return sublist;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue