summary refs log tree commit diff
path: root/src/timeline/RoomlistModel.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2022-07-16 01:10:07 +0000
committerGitHub <noreply@github.com>2022-07-16 01:10:07 +0000
commitf62cb7768048bf737d3ec3b483a14e2e18cc1017 (patch)
treefebc4d195b7fa3c9a4f593d33346790c7d43f933 /src/timeline/RoomlistModel.cpp
parentMerge pull request #1110 from r0hit05/msc2746 (diff)
parentMake notification count calculation more efficient (diff)
downloadnheko-f62cb7768048bf737d3ec3b483a14e2e18cc1017.tar.xz
Merge pull request #1062 from Nheko-Reborn/perSpaceNotifs
Per-space notification bubbles
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r--src/timeline/RoomlistModel.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp

index 1cf16243..1869d2e0 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp
@@ -330,10 +330,13 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification) Qt::DisplayRole, }); + if (getRoomById(room_id)->isSpace()) + return; // no need to update space notifications + int total_unread_msgs = 0; for (const auto &room : qAsConst(models)) { - if (!room.isNull()) + if (!room.isNull() && !room->isSpace()) total_unread_msgs += room->notificationCount(); } @@ -639,15 +642,18 @@ RoomlistModel::clear() } void -RoomlistModel::joinPreview(QString roomid, QString parentSpace) +RoomlistModel::joinPreview(QString roomid) { if (previewedRooms.contains(roomid)) { - auto child = cache::client()->getStateEvent<mtx::events::state::space::Child>( - parentSpace.toStdString(), roomid.toStdString()); - ChatPage::instance()->joinRoomVia( - roomid.toStdString(), - (child && child->content.via) ? child->content.via.value() : std::vector<std::string>{}, - false); + std::vector<std::string> vias; + auto parents = cache::client()->getParentRoomIds(roomid.toStdString()); + for (const auto &p : parents) { + auto child = cache::client()->getStateEvent<mtx::events::state::space::Child>( + p, roomid.toStdString()); + if (child && child->content.via) + vias.insert(vias.end(), child->content.via->begin(), child->content.via->end()); + } + ChatPage::instance()->joinRoomVia(roomid.toStdString(), vias, false); } } void