Fix HTML escaping
This commit is contained in:
@@ -26,7 +26,7 @@ Kirigami.ScrollablePage {
|
|||||||
/// Used to determine if scrolling to the bottom should mark the message as unread
|
/// Used to determine if scrolling to the bottom should mark the message as unread
|
||||||
property bool hasScrolledUpBefore: false;
|
property bool hasScrolledUpBefore: false;
|
||||||
|
|
||||||
title: currentRoom.displayName
|
title: currentRoom.htmlSafeDisplayName
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: RoomManager
|
target: RoomManager
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
|
|||||||
Q_EMIT isInviteChanged();
|
Q_EMIT isInviteChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(this, &Room::displaynameChanged, this, &NeoChatRoom::displayNameChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NeoChatRoom::uploadFile(const QUrl &url, const QString &body)
|
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;
|
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(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
||||||
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
||||||
Q_PROPERTY(bool isInvite READ isInvite NOTIFY isInviteChanged)
|
Q_PROPERTY(bool isInvite READ isInvite NOTIFY isInviteChanged)
|
||||||
|
Q_PROPERTY(QString htmlSafeDisplayName READ htmlSafeDisplayName NOTIFY displayNameChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NeoChatRoom(Connection *connection, QString roomId, JoinState joinState = {});
|
explicit NeoChatRoom(Connection *connection, QString roomId, JoinState joinState = {});
|
||||||
@@ -112,6 +113,9 @@ public:
|
|||||||
|
|
||||||
bool isInvite() const;
|
bool isInvite() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE QString htmlSafeName() const;
|
||||||
|
Q_INVOKABLE QString htmlSafeDisplayName() const;
|
||||||
|
|
||||||
#ifndef QUOTIENT_07
|
#ifndef QUOTIENT_07
|
||||||
Q_INVOKABLE QString htmlSafeMemberName(const QString &userId) const
|
Q_INVOKABLE QString htmlSafeMemberName(const QString &userId) const
|
||||||
{
|
{
|
||||||
@@ -146,6 +150,7 @@ Q_SIGNALS:
|
|||||||
void readMarkerLoadedChanged();
|
void readMarkerLoadedChanged();
|
||||||
void lastActiveTimeChanged();
|
void lastActiveTimeChanged();
|
||||||
void isInviteChanged();
|
void isInviteChanged();
|
||||||
|
void displayNameChanged();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void uploadFile(const QUrl &url, const QString &body = QString());
|
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());
|
NeoChatRoom *room = m_rooms.at(index.row());
|
||||||
if (role == NameRole) {
|
if (role == NameRole) {
|
||||||
return !room->name().isEmpty() ? room->name() : room->displayName();
|
return !room->name().isEmpty() ? room->htmlSafeName() : room->htmlSafeDisplayName();
|
||||||
}
|
}
|
||||||
if (role == DisplayNameRole) {
|
if (role == DisplayNameRole) {
|
||||||
return room->displayName();
|
return room->displayName();
|
||||||
|
|||||||
Reference in New Issue
Block a user