aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-02-16 10:13:19 +0100
committerGitHub <noreply@github.com>2021-02-16 10:13:19 +0100
commit48d2ecc4df4d1883326036e55949156cfb37acc6 (patch)
tree0daf4b37c887cb3292c4713c611e144d2a8bb5c1 /lib
parent3fbd9ca775caeca4a28aeb48f5c8db013659c263 (diff)
parentfb6e3f215774d48f7e0c6000cc7a9ebbc66ceb64 (diff)
downloadlibquotient-48d2ecc4df4d1883326036e55949156cfb37acc6.tar.gz
libquotient-48d2ecc4df4d1883326036e55949156cfb37acc6.zip
Merge pull request #442 from ognarb/localuserinfo
Load user info (display name + avatar) for the local user.
Diffstat (limited to 'lib')
-rw-r--r--lib/user.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/user.cpp b/lib/user.cpp
index bed7be3a..9f0386f4 100644
--- a/lib/user.cpp
+++ b/lib/user.cpp
@@ -49,6 +49,16 @@ User::User(QString userId, Connection* connection)
: QObject(connection), d(new Private(move(userId)))
{
setObjectName(id());
+ if (connection->userId() == id()) {
+ // Load profile information for local user.
+ auto *profileJob = connection->callApi<GetUserProfileJob>(id());
+ connect(profileJob, &BaseJob::result, this, [this, profileJob] {
+ d->defaultName = profileJob->displayname();
+ d->defaultAvatar = Avatar(QUrl(profileJob->avatarUrl()));
+ emit defaultNameChanged();
+ emit defaultAvatarChanged();
+ });
+ }
}
Connection* User::connection() const