Don't show banned user as sender for state events

BUG: 461158
This commit is contained in:
Tobias Fella
2022-10-31 16:10:09 +01:00
parent 66fadd78a3
commit 08300b994c

View File

@@ -842,7 +842,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
}
if (role == AuthorDisplayNameRole) {
if (!evt.unsignedJson()["prev_content"]["displayname"].isNull()) {
if (is<RoomMemberEvent>(evt) && !evt.unsignedJson()["prev_content"]["displayname"].isNull() && evt.stateKey() == evt.senderId()) {
auto previousDisplayName = evt.unsignedJson()["prev_content"]["displayname"].toString().toHtmlEscaped();
if (previousDisplayName.isEmpty()) {
previousDisplayName = evt.senderId();
@@ -850,7 +850,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
return previousDisplayName;
} else {
auto author = static_cast<NeoChatUser *>(isPending ? m_currentRoom->localUser() : m_currentRoom->user(evt.senderId()));
m_currentRoom->htmlSafeMemberName(author->id());
return m_currentRoom->htmlSafeMemberName(author->id());
}
}