diff options
Diffstat (limited to 'lib/user.cpp')
-rw-r--r-- | lib/user.cpp | 12 |
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 } |