aboutsummaryrefslogtreecommitdiff
path: root/lib/user.cpp
diff options
context:
space:
mode:
authorHubert Chathi <uhoreg@debian.org>2021-10-16 00:03:36 -0400
committerHubert Chathi <uhoreg@debian.org>2021-10-16 00:03:36 -0400
commit5a8c406749160a01865cbac8b4591a8e3c31e4c6 (patch)
tree0bafb35b381954589f90fccfa3e5ff34e871c494 /lib/user.cpp
parenteb2f105aea98f640e2f95854983bb06ade95bb3e (diff)
parent0a342369406e2d259ce20e5fa6d53ac271cbf3c2 (diff)
downloadlibquotient-5a8c406749160a01865cbac8b4591a8e3c31e4c6.tar.gz
libquotient-5a8c406749160a01865cbac8b4591a8e3c31e4c6.zip
Update to upstream version 0.6.11
Diffstat (limited to 'lib/user.cpp')
-rw-r--r--lib/user.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/user.cpp b/lib/user.cpp
index 85f9d9a7..4e369a4f 100644
--- a/lib/user.cpp
+++ b/lib/user.cpp
@@ -71,7 +71,9 @@ void User::Private::fetchProfile(const User* q)
{
defaultAvatar.emplace(Avatar {});
defaultName = "";
- auto* j = q->connection()->callApi<GetUserProfileJob>(BackgroundRequest, id);
+ auto* j =
+ q->connection()->callApi<GetUserProfileJob>(BackgroundRequest,
+ QUrl::toPercentEncoding(id));
// FIXME: accepting const User* and const_cast'ing it here is only
// until we get a better User API in 0.7
QObject::connect(j, &BaseJob::success, q,
@@ -171,11 +173,11 @@ void User::rename(const QString& newName, const Room* r)
rename(newName);
return;
}
- Q_ASSERT_X(r->memberJoinState(this) == JoinState::Join, __FUNCTION__,
+ // #481: take the current state and update it with the new name
+ auto evtC = r->getCurrentState<RoomMemberEvent>(id())->content();
+ Q_ASSERT_X(evtC.membership == MembershipType::Join, __FUNCTION__,
"Attempt to rename a user that's not a room member");
- const auto actualNewName = sanitized(newName);
- MemberEventContent evtC;
- evtC.displayName = actualNewName;
+ evtC.displayName = sanitized(newName);
r->setState<RoomMemberEvent>(id(), move(evtC));
// The state will be updated locally after it arrives with sync
}