mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Try to fix avatars not updating after deletion
This commit is contained in:
parent
7a2b996f18
commit
95272ce4ab
3 changed files with 6 additions and 5 deletions
|
@ -1423,6 +1423,7 @@ Cache::getRoomAvatarUrl(lmdb::txn &txn,
|
||||||
StateEvent<Avatar> msg =
|
StateEvent<Avatar> msg =
|
||||||
json::parse(std::string(event.data(), event.size()));
|
json::parse(std::string(event.data(), event.size()));
|
||||||
|
|
||||||
|
if (!msg.content.url.empty())
|
||||||
return QString::fromStdString(msg.content.url);
|
return QString::fromStdString(msg.content.url);
|
||||||
} catch (const json::exception &e) {
|
} catch (const json::exception &e) {
|
||||||
nhlog::db()->warn("failed to parse m.room.avatar event: {}", e.what());
|
nhlog::db()->warn("failed to parse m.room.avatar event: {}", e.what());
|
||||||
|
|
|
@ -419,6 +419,9 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event)
|
||||||
void
|
void
|
||||||
RoomInfoListItem::setAvatar(const QString &avatar_url)
|
RoomInfoListItem::setAvatar(const QString &avatar_url)
|
||||||
{
|
{
|
||||||
|
if (avatar_url.isEmpty())
|
||||||
|
avatar_->setLetter(utils::firstChar(roomName_));
|
||||||
|
else
|
||||||
avatar_->setImage(avatar_url);
|
avatar_->setImage(avatar_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,6 @@ RoomList::addRoom(const QString &room_id, const RoomInfo &info)
|
||||||
void
|
void
|
||||||
RoomList::updateAvatar(const QString &room_id, const QString &url)
|
RoomList::updateAvatar(const QString &room_id, const QString &url)
|
||||||
{
|
{
|
||||||
if (url.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
emit updateRoomAvatarCb(room_id, url);
|
emit updateRoomAvatarCb(room_id, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue