summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--resources/qml/ElidedLabel.qml2
-rw-r--r--resources/qml/RoomList.qml2
-rw-r--r--src/timeline/RoomlistModel.cpp2
-rw-r--r--src/timeline/TimelineModel.cpp11
-rw-r--r--src/timeline/TimelineModel.h1
-rw-r--r--src/timeline/TimelineViewManager.h1
6 files changed, 17 insertions, 2 deletions
diff --git a/resources/qml/ElidedLabel.qml b/resources/qml/ElidedLabel.qml
index 5ae99de7..1f4aeeea 100644
--- a/resources/qml/ElidedLabel.qml
+++ b/resources/qml/ElidedLabel.qml
@@ -13,7 +13,7 @@ Label {
     property alias elideWidth: metrics.elideWidth
 
     color: Nheko.colors.text
-    text: metrics.elidedText
+    text: (textFormat == Text.PlainText) ? metrics.elidedText : TimelineManager.escapeEmoji(TimelineManager.htmlEscape(metrics.elidedText))
     maximumLineCount: 1
     elide: Text.ElideRight
     textFormat: Text.PlainText
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml
index f2a957c9..89af78a5 100644
--- a/resources/qml/RoomList.qml
+++ b/resources/qml/RoomList.qml
@@ -119,6 +119,7 @@ Page {
                             color: roomItem.importantText
                             elideWidth: textContent.width - timestamp.width - Nheko.paddingMedium
                             fullText: model.roomName
+                            textFormat: Text.RichText
                         }
 
                         Item {
@@ -146,6 +147,7 @@ Page {
                             font.pixelSize: fontMetrics.font.pixelSize * 0.9
                             elideWidth: textContent.width - (notificationBubble.visible ? notificationBubble.width : 0) - Nheko.paddingSmall
                             fullText: model.lastMessage
+                            textFormat: Text.RichText
                         }
 
                         Item {
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index afe9679a..6d741322 100644
--- a/src/timeline/RoomlistModel.cpp
+++ b/src/timeline/RoomlistModel.cpp
@@ -62,7 +62,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const
                 case Roles::AvatarUrl:
                         return room->roomAvatarUrl();
                 case Roles::RoomName:
-                        return room->roomName();
+                        return room->plainRoomName();
                 case Roles::RoomId:
                         return room->roomId();
                 case Roles::LastMessage:
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 2625127c..8f4a8564 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -1891,6 +1891,17 @@ TimelineModel::roomName() const
 }
 
 QString
+TimelineModel::plainRoomName() const
+{
+        auto info = cache::getRoomInfo({room_id_.toStdString()});
+
+        if (!info.count(room_id_))
+                return "";
+        else
+                return QString::fromStdString(info[room_id_].name);
+}
+
+QString
 TimelineModel::roomAvatarUrl() const
 {
         auto info = cache::getRoomInfo({room_id_.toStdString()});
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index b3d3b663..3ebbe120 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -307,6 +307,7 @@ public slots:
         }
 
         QString roomName() const;
+        QString plainRoomName() const;
         QString roomTopic() const;
         InputBar *input() { return &input_; }
         Permissions *permissions() { return &permissions_; }
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index f4297243..609f5a4a 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -67,6 +67,7 @@ public:
         Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId);
         Q_INVOKABLE QColor userColor(QString id, QColor background);
         Q_INVOKABLE QString escapeEmoji(QString str) const;
+        Q_INVOKABLE QString htmlEscape(QString str) const { return str.toHtmlEscaped(); }
 
         Q_INVOKABLE QString userPresence(QString id) const;
         Q_INVOKABLE QString userStatus(QString id) const;