mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
@@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "data/notify/data_notify_settings.h"
|
#include "data/notify/data_notify_settings.h"
|
||||||
#include "data/stickers/data_stickers.h"
|
#include "data/stickers/data_stickers.h"
|
||||||
#include "data/data_saved_messages.h"
|
#include "data/data_saved_messages.h"
|
||||||
|
#include "data/data_saved_sublist.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
@@ -43,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "data/data_histories.h"
|
#include "data/data_histories.h"
|
||||||
#include "data/data_folder.h"
|
#include "data/data_folder.h"
|
||||||
#include "data/data_forum.h"
|
#include "data/data_forum.h"
|
||||||
|
#include "data/data_forum_topic.h"
|
||||||
#include "data/data_send_action.h"
|
#include "data/data_send_action.h"
|
||||||
#include "data/data_stories.h"
|
#include "data/data_stories.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reactions.h"
|
||||||
@@ -1701,7 +1703,13 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
|||||||
local->history()->peer,
|
local->history()->peer,
|
||||||
local->date());
|
local->date());
|
||||||
}
|
}
|
||||||
local->setRealId(d.vid().v);
|
local->setRealId(newId);
|
||||||
|
if (const auto topic = local->topic()) {
|
||||||
|
topic->applyMaybeLast(local);
|
||||||
|
}
|
||||||
|
if (const auto sublist = local->savedSublist()) {
|
||||||
|
sublist->applyMaybeLast(local);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -836,6 +836,16 @@ void ForumTopic::applyColorId(int32 colorId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ForumTopic::applyMaybeLast(not_null<HistoryItem*> item) {
|
||||||
|
if (!_lastServerMessage.value_or(nullptr)
|
||||||
|
|| (*_lastServerMessage)->id < item->id) {
|
||||||
|
setLastServerMessage(item);
|
||||||
|
resolveChatListMessageGroup();
|
||||||
|
} else {
|
||||||
|
growLastKnownServerMessageId(item->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ForumTopic::applyItemAdded(not_null<HistoryItem*> item) {
|
void ForumTopic::applyItemAdded(not_null<HistoryItem*> item) {
|
||||||
if (item->isRegular()) {
|
if (item->isRegular()) {
|
||||||
setLastServerMessage(item);
|
setLastServerMessage(item);
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ public:
|
|||||||
void applyCreator(PeerId creatorId);
|
void applyCreator(PeerId creatorId);
|
||||||
void applyCreationDate(TimeId date);
|
void applyCreationDate(TimeId date);
|
||||||
void applyIsMy(bool my);
|
void applyIsMy(bool my);
|
||||||
|
void applyMaybeLast(not_null<HistoryItem*> item);
|
||||||
void applyItemAdded(not_null<HistoryItem*> item);
|
void applyItemAdded(not_null<HistoryItem*> item);
|
||||||
void applyItemRemoved(MsgId id);
|
void applyItemRemoved(MsgId id);
|
||||||
void maybeSetLastMessage(not_null<HistoryItem*> item);
|
void maybeSetLastMessage(not_null<HistoryItem*> item);
|
||||||
|
|||||||
@@ -187,12 +187,13 @@ rpl::producer<> SavedSublist::destroyed() const {
|
|||||||
) | rpl::to_empty);
|
) | rpl::to_empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavedSublist::applyMaybeLast(not_null<HistoryItem*> item, bool added) {
|
void SavedSublist::applyMaybeLast(not_null<HistoryItem*> item) {
|
||||||
growLastKnownServerMessageId(item->id);
|
|
||||||
if (!_lastServerMessage.value_or(nullptr)
|
if (!_lastServerMessage.value_or(nullptr)
|
||||||
|| (*_lastServerMessage)->id < item->id) {
|
|| (*_lastServerMessage)->id < item->id) {
|
||||||
setLastServerMessage(item);
|
setLastServerMessage(item);
|
||||||
resolveChatListMessageGroup();
|
resolveChatListMessageGroup();
|
||||||
|
} else {
|
||||||
|
growLastKnownServerMessageId(item->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,7 @@ public:
|
|||||||
[[nodiscard]] bool isHiddenAuthor() const;
|
[[nodiscard]] bool isHiddenAuthor() const;
|
||||||
[[nodiscard]] rpl::producer<> destroyed() const;
|
[[nodiscard]] rpl::producer<> destroyed() const;
|
||||||
|
|
||||||
void growLastKnownServerMessageId(MsgId id);
|
void applyMaybeLast(not_null<HistoryItem*> item);
|
||||||
void applyMaybeLast(not_null<HistoryItem*> item, bool added = false);
|
|
||||||
void applyItemAdded(not_null<HistoryItem*> item);
|
void applyItemAdded(not_null<HistoryItem*> item);
|
||||||
void applyItemRemoved(MsgId id);
|
void applyItemRemoved(MsgId id);
|
||||||
|
|
||||||
@@ -143,6 +142,7 @@ private:
|
|||||||
void setChatListMessage(HistoryItem *item);
|
void setChatListMessage(HistoryItem *item);
|
||||||
void allowChatListMessageResolve();
|
void allowChatListMessageResolve();
|
||||||
void resolveChatListMessageGroup();
|
void resolveChatListMessageGroup();
|
||||||
|
void growLastKnownServerMessageId(MsgId id);
|
||||||
|
|
||||||
void changeUnreadCountByMessage(MsgId id, int delta);
|
void changeUnreadCountByMessage(MsgId id, int delta);
|
||||||
void setUnreadCount(std::optional<int> count);
|
void setUnreadCount(std::optional<int> count);
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ not_null<HistoryItem*> History::addNewItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (const auto sublist = item->savedSublist()) {
|
if (const auto sublist = item->savedSublist()) {
|
||||||
sublist->applyMaybeLast(item, unread);
|
sublist->applyMaybeLast(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|||||||
Reference in New Issue
Block a user