summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-03-22 20:43:45 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-03-22 20:43:45 +0100
commit95272ce4ab0593e10bd6e6634b8ef60ab8188607 (patch)
tree5e9c10984e3ebba94e5e0eb49d395cb4ccc56153 /src
parentFix high CPU usage on 5XX error codes (diff)
downloadnheko-95272ce4ab0593e10bd6e6634b8ef60ab8188607.tar.xz
Try to fix avatars not updating after deletion
Diffstat (limited to 'src')
-rw-r--r--src/Cache.cpp3
-rw-r--r--src/RoomInfoListItem.cpp5
-rw-r--r--src/RoomList.cpp3
3 files changed, 6 insertions, 5 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp

index 3ef3ca07..fb2ded7d 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp
@@ -1423,7 +1423,8 @@ Cache::getRoomAvatarUrl(lmdb::txn &txn, StateEvent<Avatar> msg = json::parse(std::string(event.data(), event.size())); - return QString::fromStdString(msg.content.url); + if (!msg.content.url.empty()) + return QString::fromStdString(msg.content.url); } catch (const json::exception &e) { nhlog::db()->warn("failed to parse m.room.avatar event: {}", e.what()); } diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp
index cc5f5776..11818649 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp
@@ -419,7 +419,10 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event) void RoomInfoListItem::setAvatar(const QString &avatar_url) { - avatar_->setImage(avatar_url); + if (avatar_url.isEmpty()) + avatar_->setLetter(utils::firstChar(roomName_)); + else + avatar_->setImage(avatar_url); } void diff --git a/src/RoomList.cpp b/src/RoomList.cpp
index 1c7c340d..764fabb4 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp
@@ -94,9 +94,6 @@ RoomList::addRoom(const QString &room_id, const RoomInfo &info) void RoomList::updateAvatar(const QString &room_id, const QString &url) { - if (url.isEmpty()) - return; - emit updateRoomAvatarCb(room_id, url); }