Don't re-create topic when clearing its messages.
This commit is contained in:
@@ -189,7 +189,9 @@ void History::checkChatListMessageRemoved(not_null<HistoryItem*> item) {
|
||||
}
|
||||
|
||||
void History::itemVanished(not_null<HistoryItem*> item) {
|
||||
item->notificationThread()->removeNotification(item);
|
||||
if (const auto thread = item->maybeNotificationThread()) {
|
||||
thread->removeNotification(item);
|
||||
}
|
||||
if (lastKeyboardId == item->id) {
|
||||
clearLastKeyboard();
|
||||
}
|
||||
|
||||
@@ -1929,6 +1929,15 @@ not_null<Data::Thread*> HistoryItem::notificationThread() const {
|
||||
return _history;
|
||||
}
|
||||
|
||||
Data::Thread *HistoryItem::maybeNotificationThread() const {
|
||||
if (const auto rootId = topicRootId()) {
|
||||
if (const auto forum = _history->asForum()) {
|
||||
return forum->topicFor(rootId);
|
||||
}
|
||||
}
|
||||
return _history;
|
||||
}
|
||||
|
||||
Data::ForumTopic *HistoryItem::topic() const {
|
||||
if (const auto rootId = topicRootId()) {
|
||||
if (const auto forum = _history->asForum()) {
|
||||
|
||||
@@ -214,6 +214,7 @@ public:
|
||||
[[nodiscard]] TextWithEntities factcheckText() const;
|
||||
|
||||
[[nodiscard]] not_null<Data::Thread*> notificationThread() const;
|
||||
[[nodiscard]] Data::Thread *maybeNotificationThread() const;
|
||||
[[nodiscard]] not_null<History*> history() const {
|
||||
return _history;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,9 @@ System::SkipState System::skipNotification(
|
||||
const auto item = notification.item;
|
||||
const auto type = notification.type;
|
||||
const auto messageType = (type == Data::ItemNotificationType::Message);
|
||||
if (!item->notificationThread()->currentNotification()
|
||||
const auto thread = item->maybeNotificationThread();
|
||||
if (!thread
|
||||
|| !thread->currentNotification()
|
||||
|| (messageType && item->skipNotification())
|
||||
|| (type == Data::ItemNotificationType::Reaction
|
||||
&& skipReactionNotification(item))) {
|
||||
|
||||
Reference in New Issue
Block a user