From aa7ac71cfe2bcba01a1f6d23e9265549941de653 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 21 Jan 2020 21:33:35 +0100 Subject: [PATCH] Fix room avatars in settings --- src/AvatarProvider.cpp | 2 +- src/dialogs/RoomSettings.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/AvatarProvider.cpp b/src/AvatarProvider.cpp index b91657bc..89496b20 100644 --- a/src/AvatarProvider.cpp +++ b/src/AvatarProvider.cpp @@ -31,7 +31,7 @@ namespace AvatarProvider { void resolve(const QString &avatarUrl, int size, QObject *receiver, AvatarCallback callback) { - const auto cacheKey = avatarUrl + "_size_" + size; + const auto cacheKey = QString("%1_size_%2").arg(avatarUrl).arg(size); if (avatarUrl.isEmpty()) return; diff --git a/src/dialogs/RoomSettings.cpp b/src/dialogs/RoomSettings.cpp index b214b35d..865d60e0 100644 --- a/src/dialogs/RoomSettings.cpp +++ b/src/dialogs/RoomSettings.cpp @@ -352,11 +352,9 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent) } avatar_ = new Avatar(this, 128); - if (avatarImg_.isNull()) - avatar_->setLetter(utils::firstChar(QString::fromStdString(info_.name))); - else - avatar_->setImage(room_id_, - QString::fromStdString(http::client()->user_id().to_string())); + avatar_->setLetter(utils::firstChar(QString::fromStdString(info_.name))); + if (!info_.avatar_url.empty()) + avatar_->setImage(QString::fromStdString(info_.avatar_url)); if (canChangeAvatar(room_id_.toStdString(), utils::localUser().toStdString())) { auto filter = new ClickableFilter(this); @@ -637,8 +635,7 @@ RoomSettings::setAvatar() stopLoadingSpinner(); if (avatar_) - avatar_->setImage(room_id_, - QString::fromStdString(http::client()->user_id().to_string())); + avatar_->setImage(QString::fromStdString(info_.avatar_url)); } void