summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-05-18 21:37:08 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-05-18 21:37:08 +0300
commitd88dee3185c8f2c1f32859e1ae7df832b6f10c98 (patch)
tree6470a40c035f6357bb9e8b6c146d1c5e7e768ab8
parentFix crash on unfinished animation & center the edit modal (diff)
downloadnheko-d88dee3185c8f2c1f32859e1ae7df832b6f10c98.tar.xz
Refresh the room info on the top bar after sync
-rw-r--r--include/ChatPage.h1
-rw-r--r--src/ChatPage.cc12
2 files changed, 12 insertions, 1 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h

index 799f7a2e..b6c431e4 100644 --- a/include/ChatPage.h +++ b/include/ChatPage.h
@@ -88,6 +88,7 @@ signals: void syncUI(const mtx::responses::Rooms &rooms); void continueSync(const QString &next_batch); void syncRoomlist(const std::map<QString, RoomInfo> &updates); + void syncTopBar(const std::map<QString, RoomInfo> &updates); private slots: void showUnreadMessageNotification(int count); diff --git a/src/ChatPage.cc b/src/ChatPage.cc
index 6040dc66..9ae860fb 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc
@@ -440,6 +440,11 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent) http::client()->getNotifications(); }); connect(this, &ChatPage::syncRoomlist, room_list_, &RoomList::sync); + connect( + this, &ChatPage::syncTopBar, this, [this](const std::map<QString, RoomInfo> &updates) { + if (updates.find(currentRoom()) != updates.end()) + changeTopRoomInfo(currentRoom()); + }); instance_ = this; @@ -532,7 +537,12 @@ ChatPage::syncCompleted(const mtx::responses::Sync &response) try { cache::client()->saveState(res); emit syncUI(res.rooms); - emit syncRoomlist(cache::client()->roomUpdates(res)); + + auto updates = cache::client()->roomUpdates(res); + + emit syncTopBar(updates); + emit syncRoomlist(updates); + } catch (const lmdb::error &e) { std::cout << "save cache error:" << e.what() << '\n'; // TODO: retry sync.