Fix HTML escaping
This commit is contained in:
@@ -53,6 +53,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
|
||||
Q_EMIT isInviteChanged();
|
||||
}
|
||||
});
|
||||
connect(this, &Room::displaynameChanged, this, &NeoChatRoom::displayNameChanged);
|
||||
}
|
||||
|
||||
void NeoChatRoom::uploadFile(const QUrl &url, const QString &body)
|
||||
@@ -710,3 +711,13 @@ bool NeoChatRoom::isUserBanned(const QString &user) const
|
||||
{
|
||||
return getCurrentState<RoomMemberEvent>(user)->membership() == MembershipType::Ban;
|
||||
}
|
||||
|
||||
QString NeoChatRoom::htmlSafeName() const
|
||||
{
|
||||
return name().toHtmlEscaped();
|
||||
}
|
||||
|
||||
QString NeoChatRoom::htmlSafeDisplayName() const
|
||||
{
|
||||
return displayName().toHtmlEscaped();
|
||||
}
|
||||
@@ -31,6 +31,7 @@ class NeoChatRoom : public Room
|
||||
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
||||
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
||||
Q_PROPERTY(bool isInvite READ isInvite NOTIFY isInviteChanged)
|
||||
Q_PROPERTY(QString htmlSafeDisplayName READ htmlSafeDisplayName NOTIFY displayNameChanged)
|
||||
|
||||
public:
|
||||
explicit NeoChatRoom(Connection *connection, QString roomId, JoinState joinState = {});
|
||||
@@ -112,6 +113,9 @@ public:
|
||||
|
||||
bool isInvite() const;
|
||||
|
||||
Q_INVOKABLE QString htmlSafeName() const;
|
||||
Q_INVOKABLE QString htmlSafeDisplayName() const;
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
Q_INVOKABLE QString htmlSafeMemberName(const QString &userId) const
|
||||
{
|
||||
@@ -146,6 +150,7 @@ Q_SIGNALS:
|
||||
void readMarkerLoadedChanged();
|
||||
void lastActiveTimeChanged();
|
||||
void isInviteChanged();
|
||||
void displayNameChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
void uploadFile(const QUrl &url, const QString &body = QString());
|
||||
|
||||
@@ -329,7 +329,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
NeoChatRoom *room = m_rooms.at(index.row());
|
||||
if (role == NameRole) {
|
||||
return !room->name().isEmpty() ? room->name() : room->displayName();
|
||||
return !room->name().isEmpty() ? room->htmlSafeName() : room->htmlSafeDisplayName();
|
||||
}
|
||||
if (role == DisplayNameRole) {
|
||||
return room->displayName();
|
||||
|
||||
Reference in New Issue
Block a user