mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Use server time in dialogs list sorting.
This way it won't mess up when you change your local time.
This commit is contained in:
@@ -1827,14 +1827,11 @@ std::shared_ptr<AdminLog::LocalIdManager> History::adminLogIdManager() {
|
||||
return result;
|
||||
}
|
||||
|
||||
QDateTime History::adjustChatListDate() const {
|
||||
const auto result = chatsListDate();
|
||||
TimeId History::adjustChatListTimeId() const {
|
||||
const auto result = chatsListTimeId();
|
||||
if (const auto draft = cloudDraft()) {
|
||||
if (!Data::draftIsNull(draft)) {
|
||||
const auto draftResult = ParseDateTime(draft->date);
|
||||
if (draftResult > result) {
|
||||
return draftResult;
|
||||
}
|
||||
return std::max(result, draft->date);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -2182,7 +2179,7 @@ void History::setLastMessage(HistoryItem *item) {
|
||||
if (const auto feed = peer->feed()) {
|
||||
feed->updateLastMessage(item);
|
||||
}
|
||||
setChatsListDate(ItemDateTime(item));
|
||||
setChatsListTimeId(item->date());
|
||||
} else if (!_lastMessage || *_lastMessage) {
|
||||
_lastMessage = nullptr;
|
||||
updateChatListEntry();
|
||||
@@ -2500,8 +2497,8 @@ HistoryService *History::insertJoinedMessage(bool unread) {
|
||||
inviter,
|
||||
flags);
|
||||
addNewInTheMiddle(_joinedMessage, blockIndex, itemIndex);
|
||||
const auto lastDate = chatsListDate();
|
||||
if (lastDate.isNull() || ParseDateTime(inviteDate) >= lastDate) {
|
||||
const auto lastDate = chatsListTimeId();
|
||||
if (!lastDate || inviteDate >= lastDate) {
|
||||
setLastMessage(_joinedMessage);
|
||||
if (unread) {
|
||||
newItemAdded(_joinedMessage);
|
||||
|
@@ -445,7 +445,7 @@ private:
|
||||
not_null<Element*> view);
|
||||
void removeNotification(not_null<HistoryItem*> item);
|
||||
|
||||
QDateTime adjustChatListDate() const override;
|
||||
TimeId adjustChatListTimeId() const override;
|
||||
void changedInChatListHook(Dialogs::Mode list, bool added) override;
|
||||
void changedChatListPinHook() override;
|
||||
|
||||
|
Reference in New Issue
Block a user