Improve User Avatar Model Roles
- Update the message event and user models so that the full source url is output. - Separate the reply author into its own role - Create an empty user object that can be passed so that the QML code no longer needs to check if certain parameters exist. - Make avatarForMember return and empty QUrl if a valid avatar cannot be found and make use in the user and event models As well as cleaning up the QML this should also stop the QML Image: Media id '' doesn't follow server/mediaId pattern spam in the log.
This commit is contained in:
@@ -1921,7 +1921,12 @@ QByteArray NeoChatRoom::roomAcountDataJson(const QString &eventType)
|
||||
QUrl NeoChatRoom::avatarForMember(NeoChatUser *user) const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
return connection()->makeMediaUrl(memberAvatarUrl(user->id()));
|
||||
auto avatar = connection()->makeMediaUrl(memberAvatarUrl(user->id()));
|
||||
if (avatar.isValid() && avatar.scheme() == QStringLiteral("mxc")) {
|
||||
return avatar;
|
||||
} else {
|
||||
return QUrl();
|
||||
}
|
||||
#else
|
||||
QUrl url(QStringLiteral("mxc://%1").arg(user->avatarMediaId()));
|
||||
QUrlQuery q(url.query());
|
||||
|
||||
Reference in New Issue
Block a user