summary refs log tree commit diff
path: root/src/UsersModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-04-24 09:12:50 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-04-24 14:32:24 +0200
commit6fd485a74a9ffcfd006e4bfefa05052d48effb4b (patch)
tree217a5043f7467860f78b59a8e464d5c1f21ef7fc /src/UsersModel.cpp
parentUpdate translation files (diff)
downloadnheko-6fd485a74a9ffcfd006e4bfefa05052d48effb4b.tar.xz
Fix completions in plain text mode
Diffstat (limited to '')
-rw-r--r--src/UsersModel.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/UsersModel.cpp b/src/UsersModel.cpp
index dd77e512..c4379668 100644
--- a/src/UsersModel.cpp
+++ b/src/UsersModel.cpp
@@ -4,8 +4,11 @@
 
 #include "UsersModel.h"
 
+#include <QUrl>
+
 #include "Cache.h"
 #include "CompletionModelRoles.h"
+#include "UserSettingsPage.h"
 
 UsersModel::UsersModel(const std::string &roomId, QObject *parent)
   : QAbstractListModel(parent)
@@ -37,9 +40,12 @@ UsersModel::data(const QModelIndex &index, int role) const
         if (hasIndex(index.row(), index.column(), index.parent())) {
                 switch (role) {
                 case CompletionModel::CompletionRole:
-                        return QString("[%1](https://matrix.to/#/%2)")
-                          .arg(displayNames[index.row()])
-                          .arg(userids[index.row()]);
+                        if (UserSettings::instance()->markdown())
+                                return QString("[%1](https://matrix.to/#/%2)")
+                                  .arg(displayNames[index.row()])
+                                  .arg(QString(QUrl::toPercentEncoding(userids[index.row()])));
+                        else
+                                return displayNames[index.row()];
                 case CompletionModel::SearchRole:
                 case Qt::DisplayRole:
                 case Roles::DisplayName: