summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-05-22 10:16:42 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-05-22 10:16:42 +0200
commitf3d956aebcd34ecf8c4e2c44acd39d5de380233f (patch)
treeb7c7ff13519127636b8691cd462bb60b88b364bc /src/timeline
parentSort the room list (diff)
downloadnheko-f3d956aebcd34ecf8c4e2c44acd39d5de380233f.tar.xz
Fix emoji in new RoomList
Diffstat (limited to 'src/timeline')
-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
4 files changed, 14 insertions, 1 deletions
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;