Skip to content
Snippets Groups Projects
Verified Commit 7ebced29 authored by tastytea's avatar tastytea Committed by Nicolas Werner
Browse files

Hidden events: Make reusable read function

parent 72cfb062
No related branches found
No related tags found
No related merge requests found
......@@ -229,15 +229,7 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent)
}
emit accessJoinRulesChanged();
if (auto hiddenEvents = cache::client()->getAccountData(
mtx::events::EventType::NhekoHiddenEvents, roomid_.toStdString())) {
if (auto tmp = std::get_if<mtx::events::EphemeralEvent<
mtx::events::account_data::nheko_extensions::HiddenEvents>>(&*hiddenEvents)) {
for (const auto event : tmp->content.hidden_event_types) {
hiddenEvents_.insert(mtx::events::to_string(event).data());
}
}
}
readHiddenEventsSettings(roomid_);
}
QString
......@@ -682,3 +674,17 @@ RoomSettings::eventHidden(const QString event) const
{
return hiddenEvents_.contains(event);
}
void
RoomSettings::readHiddenEventsSettings(const QString &roomId)
{
if (auto hiddenEvents = cache::client()->getAccountData(
mtx::events::EventType::NhekoHiddenEvents, roomId.toStdString())) {
if (auto tmp = std::get_if<mtx::events::EphemeralEvent<
mtx::events::account_data::nheko_extensions::HiddenEvents>>(&*hiddenEvents)) {
for (const auto event : tmp->content.hidden_event_types) {
hiddenEvents_.insert(mtx::events::to_string(event).data());
}
}
}
}
......@@ -134,6 +134,7 @@ private:
void updateAccessRules(const std::string &room_id,
const mtx::events::state::JoinRules &,
const mtx::events::state::GuestAccess &);
void readHiddenEventsSettings(const QString &roomId = {});
private:
QString roomid_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment