summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-01-22 03:18:36 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-01-22 03:18:36 +0100
commit1c984265366ed68f296a1c5aed6b47a23220334a (patch)
tree93844f9622528f2416d1465882b79d12873a2b6b /src
parentProperly skip device, if it has no keys (diff)
downloadnheko-1c984265366ed68f296a1c5aed6b47a23220334a.tar.xz
Fix tags
Diffstat (limited to 'src')
-rw-r--r--src/Cache.cpp32
-rw-r--r--src/RoomInfoListItem.cpp3
2 files changed, 18 insertions, 17 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp

index e2aecca2..7e25fed2 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp
@@ -1235,11 +1235,11 @@ Cache::saveState(const mtx::responses::Sync &res) updatedInfo.avatar_url = getRoomAvatarUrl(txn, statesdb, membersdb).toStdString(); updatedInfo.version = getRoomVersion(txn, statesdb).toStdString(); + bool has_new_tags = false; // Process the account_data associated with this room if (!room.second.account_data.events.empty()) { auto accountDataDb = getAccountDataDb(txn, room.first); - bool has_new_tags = false; for (const auto &evt : room.second.account_data.events) { std::visit( [&txn, &accountDataDb](const auto &event) { @@ -1266,21 +1266,21 @@ Cache::saveState(const mtx::responses::Sync &res) nhlog::db()->debug("Fully read: {}", fr->content.event_id); } } - if (!has_new_tags) { - // retrieve the old tags, they haven't changed - lmdb::val data; - if (lmdb::dbi_get(txn, roomsDb_, lmdb::val(room.first), data)) { - try { - RoomInfo tmp = json::parse( - std::string_view(data.data(), data.size())); - updatedInfo.tags = tmp.tags; - } catch (const json::exception &e) { - nhlog::db()->warn( - "failed to parse room info: room_id ({}), {}: {}", - room.first, - std::string(data.data(), data.size()), - e.what()); - } + } + if (!has_new_tags) { + // retrieve the old tags, they haven't changed + lmdb::val data; + if (lmdb::dbi_get(txn, roomsDb_, lmdb::val(room.first), data)) { + try { + RoomInfo tmp = + json::parse(std::string_view(data.data(), data.size())); + updatedInfo.tags = tmp.tags; + } catch (const json::exception &e) { + nhlog::db()->warn( + "failed to parse room info: room_id ({}), {}: {}", + room.first, + std::string(data.data(), data.size()), + e.what()); } } } diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp
index 0acfcc90..427af632 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp
@@ -145,11 +145,12 @@ RoomInfoListItem::init(QWidget *parent) tagAction->setWhatsThis(tr("Adds or removes the specified tag.", "WhatsThis hint for tag menu actions")); - for (const auto &riTag : roomInfo.tags) + for (const auto &riTag : roomInfo.tags) { if (riTag == tag) { tagAction->setChecked(true); break; } + } connect(tagAction, &QAction::triggered, this, [this, tag](bool checked) { if (checked)