summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorNepNep21 <43792621+NepNep21@users.noreply.github.com>2023-09-07 18:10:04 -0300
committerNepNep21 <43792621+NepNep21@users.noreply.github.com>2023-10-01 22:52:40 -0300
commit4eaba191de4fc1ae1709b90c97ec4030397f1d7c (patch)
tree4b40a0bff1104132ade714cade91e89466796b8e /src/ui
parentMove comments to proper reviews (diff)
downloadnheko-4eaba191de4fc1ae1709b90c97ec4030397f1d7c.tar.xz
Use properties
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/UserProfile.cpp25
-rw-r--r--src/ui/UserProfile.h3
2 files changed, 4 insertions, 24 deletions
diff --git a/src/ui/UserProfile.cpp b/src/ui/UserProfile.cpp

index 5146ff26..3b2375ad 100644 --- a/src/ui/UserProfile.cpp +++ b/src/ui/UserProfile.cpp
@@ -224,28 +224,10 @@ UserProfile::refreshDevices() fetchDeviceList(this->userid_); } -QVector<QString> -UserProfile::getIgnoredUsers() -{ - QVector<QString> vec; - const std::optional<mtx::events::collections::RoomAccountDataEvents::variant> optEv = - cache::client()->getAccountData(mtx::events::EventType::IgnoredUsers); - if (optEv) { - const auto &ev = - std::get<mtx::events::EphemeralEvent<mtx::events::account_data::IgnoredUsers>>(*optEv) - .content; - for (const mtx::events::account_data::IgnoredUser &user : ev.users) { - vec.append(QString::fromStdString(user.id)); - } - } - - return vec; -} - void UserProfile::ignoredStatus(const QString &id, const bool ignore) { - auto old = this->getIgnoredUsers(); + auto old = TimelineViewManager::instance()->getIgnoredUsers(); if (ignore) { if (old.contains(id)) { emit this->room()->ignoredUser(id, tr("Already ignored")); @@ -268,9 +250,8 @@ UserProfile::ignoredStatus(const QString &id, const bool ignore) if (ignore) { emit this->room()->ignoredUser( id, e ? std::optional(QString::fromStdString(e->matrix_error.error)) : std::nullopt); - } else { - emit this->unignoredUser( - id, e ? QVariant(QString::fromStdString(e->matrix_error.error)) : QVariant()); + } else if (e) { + emit this->unignoredUserError(id, QString::fromStdString(e->matrix_error.error)); } }); } diff --git a/src/ui/UserProfile.h b/src/ui/UserProfile.h
index 2908b57e..1affe8bd 100644 --- a/src/ui/UserProfile.h +++ b/src/ui/UserProfile.h
@@ -182,7 +182,6 @@ public: Q_INVOKABLE void unverify(const QString &device = QLatin1String("")); Q_INVOKABLE void fetchDeviceList(const QString &userID); Q_INVOKABLE void refreshDevices(); - Q_INVOKABLE QVector<QString> getIgnoredUsers(); Q_INVOKABLE void banUser(); Q_INVOKABLE void signOutDevice(const QString &deviceID); Q_INVOKABLE void ignoredStatus(const QString &id, const bool ignore); @@ -202,7 +201,7 @@ signals: void displayError(const QString &errorMessage); void globalUsernameRetrieved(const QString &globalUser); void devicesChanged(); - void unignoredUser(const QString &id, const QVariant &err); + void unignoredUserError(const QString &id, const QVariant &err); // internal void verificationStatiChanged();