diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-02-16 10:13:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 10:13:19 +0100 |
commit | 48d2ecc4df4d1883326036e55949156cfb37acc6 (patch) | |
tree | 0daf4b37c887cb3292c4713c611e144d2a8bb5c1 /lib | |
parent | 3fbd9ca775caeca4a28aeb48f5c8db013659c263 (diff) | |
parent | fb6e3f215774d48f7e0c6000cc7a9ebbc66ceb64 (diff) | |
download | libquotient-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.cpp | 10 |
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 |