mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Refresh the room info on the top bar after sync
This commit is contained in:
parent
4ab42c68f4
commit
d88dee3185
2 changed files with 12 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue