Unset hidden space when space is left

This commit is contained in:
Nicolas Werner 2023-11-27 22:44:29 +01:00
parent e49a65e69e
commit eb2c87f060
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -556,6 +556,11 @@ CommunitiesModel::sync(const mtx::responses::Sync &sync_)
(void)room; (void)room;
if (spaces_.count(QString::fromStdString(roomid))) if (spaces_.count(QString::fromStdString(roomid)))
tagsUpdated = true; tagsUpdated = true;
if (hiddenTagIds_.contains(QString::fromStdString("space:" + roomid))) {
hiddenTagIds_.removeAll(QString::fromStdString("space:" + roomid));
UserSettings::instance()->setHiddenTags(hiddenTagIds_);
tagsUpdated = true;
}
} }
for (const auto &e : sync_.account_data.events) { for (const auto &e : sync_.account_data.events) {
if (auto event = if (auto event =
@ -633,6 +638,12 @@ CommunitiesModel::toggleTagId(QString tagId)
hiddenTagIds_.removeOne(tagId); hiddenTagIds_.removeOne(tagId);
else else
hiddenTagIds_.push_back(tagId); hiddenTagIds_.push_back(tagId);
// sanity check to remove stale spaces
hiddenTagIds_.removeIf([this](const QString &value) {
return value.startsWith("space:") && !spaces_.contains(value.mid(6));
});
UserSettings::instance()->setHiddenTags(hiddenTagIds_); UserSettings::instance()->setHiddenTags(hiddenTagIds_);
if (tagId.startsWith(QLatin1String("tag:"))) { if (tagId.startsWith(QLatin1String("tag:"))) {