Change how room avatars are passed, fix friend avatars not loading

The problem lies in how media URLs work, in this case it the old
NeoChatRoom::avatarMediaId could pass a mxc url *or* a path that can
be put into root.connection.makeMediaUrl. So normal rooms with avatars
loaded, but never friends because room members gave the mxc URL.

Instead, change everything to use avatarMediaUrl which corrects this
issue by always passing a mxc URL to QML. This also removes the need to
call makeMediaUrl.

Fixes #675
This commit is contained in:
Joshua Goins
2024-11-16 12:08:45 -05:00
parent 9cb7ec2348
commit 6b79795229
12 changed files with 20 additions and 20 deletions

View File

@@ -431,9 +431,9 @@ QDateTime NeoChatRoom::lastActiveTime()
return messageEvents().rbegin()->get()->originTimestamp();
}
QString NeoChatRoom::avatarMediaId() const
QUrl NeoChatRoom::avatarMediaUrl() const
{
if (const auto avatar = Room::avatarMediaId(); !avatar.isEmpty()) {
if (const auto avatar = Room::avatarUrl(); !avatar.isEmpty()) {
return avatar;
}
@@ -441,7 +441,7 @@ QString NeoChatRoom::avatarMediaId() const
const auto directChatMembers = this->directChatMembers();
for (const auto member : directChatMembers) {
if (member != localMember()) {
return member.avatarMediaId();
return member.avatarUrl();
}
}