From 780d1b61c37a89f93eb58fb271083444f775acd2 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 27 Jun 2021 07:11:06 +0200 Subject: 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(...) 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). --- lib/user.cpp | 2 ++ 1 file changed, 2 insertions(+) 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(id())->avatarUrl(); r->setState(id(), move(evtC)); // The state will be updated locally after it arrives with sync } -- cgit v1.2.3