mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 07:05:13 +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:
@@ -19,11 +19,11 @@ namespace {
|
||||
|
||||
auto DialogsPosToTopShift = 0;
|
||||
|
||||
uint64 DialogPosFromDate(const QDateTime &date) {
|
||||
if (date.isNull()) {
|
||||
uint64 DialogPosFromDate(TimeId date) {
|
||||
if (!date) {
|
||||
return 0;
|
||||
}
|
||||
return (uint64(date.toTime_t()) << 32) | (++DialogsPosToTopShift);
|
||||
return (uint64(date) << 32) | (++DialogsPosToTopShift);
|
||||
}
|
||||
|
||||
uint64 ProxyPromotedDialogPos() {
|
||||
@@ -73,7 +73,7 @@ void Entry::updateChatListSortPosition() {
|
||||
? ProxyPromotedDialogPos()
|
||||
: isPinnedDialog()
|
||||
? PinnedDialogPos(_pinnedIndex)
|
||||
: DialogPosFromDate(adjustChatListDate());
|
||||
: DialogPosFromDate(adjustChatListTimeId());
|
||||
if (needUpdateInChatList()) {
|
||||
setChatListExistence(true);
|
||||
}
|
||||
@@ -94,8 +94,8 @@ void Entry::setChatListExistence(bool exists) {
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime Entry::adjustChatListDate() const {
|
||||
return chatsListDate();
|
||||
TimeId Entry::adjustChatListTimeId() const {
|
||||
return chatsListTimeId();
|
||||
}
|
||||
|
||||
void Entry::changedInChatListHook(Dialogs::Mode list, bool added) {
|
||||
@@ -128,13 +128,13 @@ PositionChange Entry::adjustByPosInChatList(
|
||||
return { movedFrom, movedTo };
|
||||
}
|
||||
|
||||
void Entry::setChatsListDate(QDateTime date) {
|
||||
if (!_lastMessageDate.isNull() && _lastMessageDate >= date) {
|
||||
void Entry::setChatsListTimeId(TimeId date) {
|
||||
if (_lastMessageTimeId && _lastMessageTimeId >= date) {
|
||||
if (!inChatList(Dialogs::Mode::All)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
_lastMessageDate = date;
|
||||
_lastMessageTimeId = date;
|
||||
updateChatListSortPosition();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user