aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/user.cpp10
-rw-r--r--quotest/quotest.cpp8
2 files changed, 18 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
diff --git a/quotest/quotest.cpp b/quotest/quotest.cpp
index 5098bc02..bf29c434 100644
--- a/quotest/quotest.cpp
+++ b/quotest/quotest.cpp
@@ -101,6 +101,7 @@ private slots:
TEST_DECL(setTopic)
TEST_DECL(changeName)
TEST_DECL(sendAndRedact)
+ TEST_DECL(showLocalUsername)
TEST_DECL(addAndRemoveTag)
TEST_DECL(markDirectChat)
TEST_DECL(visitResources)
@@ -508,6 +509,13 @@ TEST_IMPL(changeName)
return false;
}
+
+TEST_IMPL(showLocalUsername)
+{
+ auto* const localUser = connection()->user();
+ FINISH_TEST(!localUser->name().contains("@"));
+}
+
TEST_IMPL(sendAndRedact)
{
clog << "Sending a message to redact" << endl;