From 1d7575036e4682961c4696d25311e2d8cc9ce293 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 5 Sep 2022 02:00:20 +0200 Subject: Allow creating spaces --- src/timeline/CommunitiesModel.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/timeline/CommunitiesModel.cpp') diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp index adc52c7b..72d0bdfb 100644 --- a/src/timeline/CommunitiesModel.cpp +++ b/src/timeline/CommunitiesModel.cpp @@ -449,7 +449,8 @@ CommunitiesModel::clear() void CommunitiesModel::sync(const mtx::responses::Sync &sync_) { - bool tagsUpdated = false; + bool tagsUpdated = false; + const auto userid = http::client()->user_id().to_string(); for (const auto &[roomid, room] : sync_.rooms.join) { for (const auto &e : room.account_data.events) @@ -457,20 +458,28 @@ CommunitiesModel::sync(const mtx::responses::Sync &sync_) mtx::events::AccountDataEvent>(e)) { tagsUpdated = true; } - for (const auto &e : room.state.events) + for (const auto &e : room.state.events) { if (std::holds_alternative>( e) || std::holds_alternative>( - e)) { + e)) tagsUpdated = true; - } - for (const auto &e : room.timeline.events) + + if (auto ev = std::get_if>(&e); + ev && ev->state_key == userid) + tagsUpdated = true; + } + for (const auto &e : room.timeline.events) { if (std::holds_alternative>( e) || std::holds_alternative>( - e)) { + e)) tagsUpdated = true; - } + + if (auto ev = std::get_if>(&e); + ev && ev->state_key == userid) + tagsUpdated = true; + } auto roomId = QString::fromStdString(roomid); auto &oldUnreads = roomNotificationCache[roomId]; -- cgit 1.5.1