diff --git a/src/Cache.cpp b/src/Cache.cpp
index d8c78381..c41b66cc 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -3469,6 +3469,7 @@ Cache::updateUserKeys(const std::string &sync_token, const mtx::responses::Query
}
}
}
+
for (auto &[user_id, update] : updates) {
(void)update;
if (user_id == local_user) {
@@ -3476,9 +3477,8 @@ Cache::updateUserKeys(const std::string &sync_token, const mtx::responses::Query
(void)status;
emit verificationStatusChanged(user);
}
- } else {
- emit verificationStatusChanged(user_id);
}
+ emit verificationStatusChanged(user_id);
}
}
@@ -3552,6 +3552,19 @@ Cache::query_keys(const std::string &user_id,
last_changed = cache_->last_changed;
req.token = last_changed;
+ // use context object so that we can disconnect again
+ QObject *context{new QObject(this)};
+ QObject::connect(this,
+ &Cache::verificationStatusChanged,
+ context,
+ [cb, user_id, context_ = context](std::string updated_user) mutable {
+ if (user_id == updated_user) {
+ context_->deleteLater();
+ auto keys = cache::userKeys(user_id);
+ cb(keys.value_or(UserKeyCache{}), {});
+ }
+ });
+
http::client()->query_keys(
req,
[cb, user_id, last_changed, this](const mtx::responses::QueryKeys &res,
@@ -3565,21 +3578,6 @@ Cache::query_keys(const std::string &user_id,
}
emit userKeysUpdate(last_changed, res);
-
- // use context object so that we can disconnect again
- std::unique_ptr<QObject> context{new QObject};
- QObject *pcontext = context.get();
- QObject::connect(
- this,
- &Cache::verificationStatusChanged,
- pcontext,
- [cb, user_id, context_ = std::move(context)](std::string updated_user) mutable {
- if (user_id == updated_user) {
- context_.release();
- auto keys = cache::userKeys(user_id);
- cb(keys.value_or(UserKeyCache{}), {});
- }
- });
});
}
diff --git a/src/ui/NhekoGlobalObject.h b/src/ui/NhekoGlobalObject.h
index fe645a34..fc35fe22 100644
--- a/src/ui/NhekoGlobalObject.h
+++ b/src/ui/NhekoGlobalObject.h
@@ -40,7 +40,7 @@ public:
Q_INVOKABLE void openLink(QString link) const;
-private slots:
+public slots:
void updateUserProfile();
signals:
diff --git a/src/ui/UserProfile.cpp b/src/ui/UserProfile.cpp
index cef8bd85..da130242 100644
--- a/src/ui/UserProfile.cpp
+++ b/src/ui/UserProfile.cpp
@@ -42,7 +42,6 @@ UserProfile::UserProfile(QString roomid,
if (!cache::client() || !cache::client()->isDatabaseReady())
return;
- fetchDeviceList(this->userid_);
connect(cache::client(),
&Cache::verificationStatusChanged,
this,
@@ -66,7 +65,9 @@ UserProfile::UserProfile(QString roomid,
: verification::VERIFIED;
}
deviceList_.reset(deviceList_.deviceList_);
+ emit devicesChanged();
});
+ fetchDeviceList(this->userid_);
}
QHash<int, QByteArray>
@@ -223,6 +224,7 @@ UserProfile::fetchDeviceList(const QString &userID)
}
this->deviceList_.queueReset(std::move(deviceInfo));
+ emit devicesChanged();
});
});
}
diff --git a/src/ui/UserProfile.h b/src/ui/UserProfile.h
index bf71d0de..721d7230 100644
--- a/src/ui/UserProfile.h
+++ b/src/ui/UserProfile.h
@@ -90,7 +90,7 @@ class UserProfile : public QObject
Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
Q_PROPERTY(QString userid READ userid CONSTANT)
Q_PROPERTY(QString avatarUrl READ avatarUrl NOTIFY avatarUrlChanged)
- Q_PROPERTY(DeviceInfoModel *deviceList READ deviceList CONSTANT)
+ Q_PROPERTY(DeviceInfoModel *deviceList READ deviceList NOTIFY devicesChanged)
Q_PROPERTY(bool isGlobalUserProfile READ isGlobalUserProfile CONSTANT)
Q_PROPERTY(int userVerified READ getUserStatus NOTIFY userStatusChanged)
Q_PROPERTY(bool isLoading READ isLoading NOTIFY loadingChanged)
@@ -133,6 +133,7 @@ signals:
void avatarUrlChanged();
void displayError(const QString &errorMessage);
void globalUsernameRetrieved(const QString &globalUser);
+ void devicesChanged();
public slots:
void updateAvatarUrl();
|