2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Correctly move histories between chat lists.

This commit is contained in:
John Preston
2019-04-17 17:22:37 +04:00
parent 0367319934
commit c58f097535
14 changed files with 115 additions and 193 deletions

View File

@@ -2949,12 +2949,10 @@ not_null<Folder*> Session::processFolder(const MTPDfolder &data) {
// return _defaultFeedId.value();
//}
not_null<Dialogs::IndexedList*> Session::chatsList() {
return &_chatsList;
}
not_null<Dialogs::IndexedList*> Session::importantChatsList() {
return &_importantChatsList;
not_null<Dialogs::IndexedList*> Session::chatsList(Dialogs::Mode list) {
return (list == Dialogs::Mode::All)
? &_chatsList
: &_importantChatsList;
}
not_null<Dialogs::IndexedList*> Session::contactsList() {
@@ -2973,25 +2971,22 @@ auto Session::refreshChatListEntry(Dialogs::Key key)
auto result = RefreshChatListEntryResult();
result.changed = !entry->inChatList(Mode::All);
if (result.changed) {
const auto mainRow = entry->addToChatList(Mode::All, &_chatsList);
const auto mainRow = entry->addToChatList(Mode::All);
_contactsNoChatsList.del(key, mainRow);
} else {
result.moved = entry->adjustByPosInChatList(
Mode::All,
&_chatsList);
result.moved = entry->adjustByPosInChatList(Mode::All);
}
if (Global::DialogsModeEnabled()) {
if (entry->toImportant()) {
result.importantChanged = !entry->inChatList(Mode::Important);
if (result.importantChanged) {
entry->addToChatList(Mode::Important, &_importantChatsList);
entry->addToChatList(Mode::Important);
} else {
result.importantMoved = entry->adjustByPosInChatList(
Mode::Important,
&_importantChatsList);
Mode::Important);
}
} else if (entry->inChatList(Mode::Important)) {
entry->removeFromChatList(Mode::Important, &_importantChatsList);
entry->removeFromChatList(Mode::Important);
result.importantChanged = true;
}
}
@@ -3002,9 +2997,9 @@ void Session::removeChatListEntry(Dialogs::Key key) {
using namespace Dialogs;
const auto entry = key.entry();
entry->removeFromChatList(Mode::All, &_chatsList);
entry->removeFromChatList(Mode::All);
if (Global::DialogsModeEnabled()) {
entry->removeFromChatList(Mode::Important, &_importantChatsList);
entry->removeFromChatList(Mode::Important);
}
if (_contactsList.contains(key)) {
if (!_contactsNoChatsList.contains(key)) {