aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-06-27 07:11:06 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-06-27 07:11:06 +0200
commit780d1b61c37a89f93eb58fb271083444f775acd2 (patch)
treedbfdbcc5346f74e9b15195e274d1b0a57261d8dc /lib
parentebea54ba87558e50604976821f378d125f6b498e (diff)
downloadlibquotient-780d1b61c37a89f93eb58fb271083444f775acd2.tar.gz
libquotient-780d1b61c37a89f93eb58fb271083444f775acd2.zip
Retain the current room member avatar when renaming
Closes #481. Note: the library doesn't even have the API in User to set per-room avatars; one still can achieve that by calling Room::setState<RoomMemberEvent>(...) though (and it's likely to be _the_ recommended way to deal with per-room user profiles in 0.7, with User being entirely deprecated).
Diffstat (limited to 'lib')
-rw-r--r--lib/user.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/user.cpp b/lib/user.cpp
index 85f9d9a7..7143620f 100644
--- a/lib/user.cpp
+++ b/lib/user.cpp
@@ -176,6 +176,8 @@ void User::rename(const QString& newName, const Room* r)
const auto actualNewName = sanitized(newName);
MemberEventContent evtC;
evtC.displayName = actualNewName;
+ // #481: fill in the current avatar URL in order to not clear it out
+ evtC.avatarUrl = r->getCurrentState<RoomMemberEvent>(id())->avatarUrl();
r->setState<RoomMemberEvent>(id(), move(evtC));
// The state will be updated locally after it arrives with sync
}