From c11b977f1d6f465be128ddac9bdd52174db619b9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 30 Dec 2018 13:16:50 +0400 Subject: [PATCH] Fix lagging chat list update in support. --- Telegram/SourceFiles/dialogs/dialogs_entry.cpp | 5 +++++ .../SourceFiles/dialogs/dialogs_inner_widget.cpp | 12 +++--------- Telegram/SourceFiles/dialogs/dialogs_inner_widget.h | 2 +- Telegram/SourceFiles/dialogs/dialogs_widget.cpp | 6 ++---- Telegram/SourceFiles/dialogs/dialogs_widget.h | 2 +- Telegram/SourceFiles/history/history.cpp | 2 +- Telegram/SourceFiles/history/history_item.cpp | 2 +- Telegram/SourceFiles/history/history_service.cpp | 2 +- Telegram/SourceFiles/mainwidget.cpp | 6 ++---- Telegram/SourceFiles/mainwidget.h | 2 +- 10 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Telegram/SourceFiles/dialogs/dialogs_entry.cpp b/Telegram/SourceFiles/dialogs/dialogs_entry.cpp index d6407e340f..ea486ee991 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_entry.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_entry.cpp @@ -73,6 +73,7 @@ void Entry::updateChatListSortPosition() { if (Auth().supportMode() && _sortKeyInChatList != 0 && Auth().settings().supportFixChatsOrder()) { + updateChatListEntry(); return; } _sortKeyInChatList = useProxyPromotion() @@ -199,6 +200,10 @@ void Entry::updateChatListEntry() const { mainChatListLink(Mode::Important)); } } + if (Auth().supportMode() + && !Auth().settings().supportAllSearchResults()) { + main->repaintDialogRow({ _key, FullMsgId() }); + } } } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 0554a80511..08603eeff0 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -1346,13 +1346,8 @@ void DialogsInner::repaintDialogRow( } } -void DialogsInner::repaintDialogRow( - not_null history, - MsgId messageId) { - updateDialogRow({ - history, - FullMsgId(history->channelId(), messageId) - }); +void DialogsInner::repaintDialogRow(Dialogs::RowDescriptor row) { + updateDialogRow(row); } void DialogsInner::updateSearchResult(not_null peer) { @@ -1439,8 +1434,7 @@ void DialogsInner::updateDialogRow( const auto add = searchedOffset(); auto index = 0; for (const auto &result : _searchResults) { - auto item = result->item(); - if (item->fullId() == row.fullId) { + if (isSearchResultActive(result.get(), row)) { updateRow(add + index * st::dialogsRowHeight); break; } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h index 9c3c04ed90..4d2c49500e 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h @@ -55,7 +55,7 @@ public: void createDialog(Dialogs::Key key); void removeDialog(Dialogs::Key key); void repaintDialogRow(Dialogs::Mode list, not_null row); - void repaintDialogRow(not_null history, MsgId messageId); + void repaintDialogRow(Dialogs::RowDescriptor row); void dragLeft(); diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 4ec637ae92..2f589ee363 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -319,10 +319,8 @@ void DialogsWidget::repaintDialogRow( _inner->repaintDialogRow(list, row); } -void DialogsWidget::repaintDialogRow( - not_null history, - MsgId messageId) { - _inner->repaintDialogRow(history, messageId); +void DialogsWidget::repaintDialogRow(Dialogs::RowDescriptor row) { + _inner->repaintDialogRow(row); } void DialogsWidget::dialogsToUp() { diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.h b/Telegram/SourceFiles/dialogs/dialogs_widget.h index 085c4c05f7..a229787deb 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.h @@ -61,7 +61,7 @@ public: void createDialog(Dialogs::Key key); void removeDialog(Dialogs::Key key); void repaintDialogRow(Dialogs::Mode list, not_null row); - void repaintDialogRow(not_null history, MsgId messageId); + void repaintDialogRow(Dialogs::RowDescriptor row); void dialogsToUp(); diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 0d96dda9f1..f7ee0f4423 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1725,7 +1725,7 @@ void History::outboxRead(MsgId upTo) { if (const auto last = lastMessage()) { if (last->out() && IsServerMsgId(last->id) && last->id <= upTo) { if (const auto main = App::main()) { - main->repaintDialogRow(this, last->id); + main->repaintDialogRow({ this, last->fullId() }); } } } diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 656bb53dfb..bf67bbd0d7 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -217,7 +217,7 @@ ReplyKeyboard *HistoryItem::inlineReplyKeyboard() { void HistoryItem::invalidateChatsListEntry() { if (const auto main = App::main()) { // #TODO feeds search results - main->repaintDialogRow(history(), id); + main->repaintDialogRow({ history(), fullId() }); } // invalidate cache for drawInDialog diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 083cfaec2f..ce3034aa13 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -691,7 +691,7 @@ void HistoryService::updateDependentText() { } if (const auto main = App::main()) { // #TODO feeds search results - main->repaintDialogRow(history(), id); + main->repaintDialogRow({ history(), fullId() }); } App::historyUpdateDependent(this); } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 865b7e9b10..739427d3ff 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2209,10 +2209,8 @@ void MainWidget::repaintDialogRow( _dialogs->repaintDialogRow(list, row); } -void MainWidget::repaintDialogRow( - not_null history, - MsgId messageId) { - _dialogs->repaintDialogRow(history, messageId); +void MainWidget::repaintDialogRow(Dialogs::RowDescriptor row) { + _dialogs->repaintDialogRow(row); } void MainWidget::windowShown() { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index cc5fd59a25..73498f093e 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -116,7 +116,7 @@ public: void createDialog(Dialogs::Key key); void removeDialog(Dialogs::Key key); void repaintDialogRow(Dialogs::Mode list, not_null row); - void repaintDialogRow(not_null history, MsgId messageId); + void repaintDialogRow(Dialogs::RowDescriptor row); void windowShown();