Always pass displayName without matrix id to avatar name
BUG: 456638
This commit is contained in:
@@ -73,7 +73,7 @@ Control {
|
|||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.small
|
Layout.preferredHeight: Kirigami.Units.iconSizes.small
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
name: author.displayName
|
name: model.displayNameForInitials
|
||||||
source: author.avatarMediaId ? ("image://mxc/" + author.avatarMediaId) : ""
|
source: author.avatarMediaId ? ("image://mxc/" + author.avatarMediaId) : ""
|
||||||
color: author.color
|
color: author.color
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ QQC2.ItemDelegate {
|
|||||||
visible: model.showAuthor &&
|
visible: model.showAuthor &&
|
||||||
Config.showAvatarInTimeline &&
|
Config.showAvatarInTimeline &&
|
||||||
(Config.compactLayout || !showUserMessageOnRight)
|
(Config.compactLayout || !showUserMessageOnRight)
|
||||||
name: model.author.name ?? model.author.displayName
|
name: model.displayNameForInitials
|
||||||
source: visible && model.author.avatarMediaId ? ("image://mxc/" + model.author.avatarMediaId) : ""
|
source: visible && model.author.avatarMediaId ? ("image://mxc/" + model.author.avatarMediaId) : ""
|
||||||
color: model.author.color
|
color: model.author.color
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
|
|||||||
roles[AuthorIdRole] = "authorId";
|
roles[AuthorIdRole] = "authorId";
|
||||||
roles[MediaUrlRole] = "mediaUrl";
|
roles[MediaUrlRole] = "mediaUrl";
|
||||||
roles[VerifiedRole] = "verified";
|
roles[VerifiedRole] = "verified";
|
||||||
|
roles[DisplayNameForInitialsRole] = "displayNameForInitials";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,6 +835,11 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (role == DisplayNameForInitialsRole) {
|
||||||
|
auto user = static_cast<NeoChatUser *>(isPending ? m_currentRoom->localUser() : m_currentRoom->user(evt.senderId()));
|
||||||
|
return user->displayname(m_currentRoom).remove(QStringLiteral(" (%1)").arg(user->id()));
|
||||||
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ public:
|
|||||||
EventResolvedTypeRole,
|
EventResolvedTypeRole,
|
||||||
AuthorIdRole,
|
AuthorIdRole,
|
||||||
VerifiedRole,
|
VerifiedRole,
|
||||||
|
|
||||||
|
// Sender's displayname, always without the matrix id
|
||||||
|
DisplayNameForInitialsRole,
|
||||||
LastRole, // Keep this last
|
LastRole, // Keep this last
|
||||||
};
|
};
|
||||||
Q_ENUM(EventRoles)
|
Q_ENUM(EventRoles)
|
||||||
|
|||||||
Reference in New Issue
Block a user