Fix room avatars in settings

This commit is contained in:
Nicolas Werner 2020-01-21 21:33:35 +01:00
parent fcc7c0ce5b
commit aa7ac71cfe
2 changed files with 5 additions and 8 deletions

View file

@ -31,7 +31,7 @@ namespace AvatarProvider {
void void
resolve(const QString &avatarUrl, int size, QObject *receiver, AvatarCallback callback) 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()) if (avatarUrl.isEmpty())
return; return;

View file

@ -352,11 +352,9 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
} }
avatar_ = new Avatar(this, 128); avatar_ = new Avatar(this, 128);
if (avatarImg_.isNull()) avatar_->setLetter(utils::firstChar(QString::fromStdString(info_.name)));
avatar_->setLetter(utils::firstChar(QString::fromStdString(info_.name))); if (!info_.avatar_url.empty())
else avatar_->setImage(QString::fromStdString(info_.avatar_url));
avatar_->setImage(room_id_,
QString::fromStdString(http::client()->user_id().to_string()));
if (canChangeAvatar(room_id_.toStdString(), utils::localUser().toStdString())) { if (canChangeAvatar(room_id_.toStdString(), utils::localUser().toStdString())) {
auto filter = new ClickableFilter(this); auto filter = new ClickableFilter(this);
@ -637,8 +635,7 @@ RoomSettings::setAvatar()
stopLoadingSpinner(); stopLoadingSpinner();
if (avatar_) if (avatar_)
avatar_->setImage(room_id_, avatar_->setImage(QString::fromStdString(info_.avatar_url));
QString::fromStdString(http::client()->user_id().to_string()));
} }
void void