From b3f93b969c824b49cbd72a272604323f7b13f056 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 4 Dec 2019 18:27:56 -0400 Subject: [PATCH] Fix RoomMessageUnknown not seen as general event --- src/qml/SidePane/RoomDelegate.qml | 12 +++++++----- src/qml/utils.js | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/qml/SidePane/RoomDelegate.qml b/src/qml/SidePane/RoomDelegate.qml index 64545160..1243e87e 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -67,11 +67,13 @@ HTileDelegate { subtitle.text: { if (! lastEvent) return "" - // If it's an emote or non-message/media event - if (lastEvent.event_type === "RoomMessageEmote" || - (! lastEvent.event_type.startsWith("RoomMessage") && - ! lastEvent.event_type.startsWith("RoomEncrypted"))) - { + let isEmote = lastEvent.event_type === "RoomMessageEmote" + let isMsg = lastEvent.event_type.startsWith("RoomMessage") + let isUnknownMsg = lastEvent.event_type === "RoomMessageUnknown" + let isCryptMedia = lastEvent.event_type.startsWith("RoomEncrypted") + + // If it's a general event + if (isEmote || isUnknownMsg || (! isMsg && ! isCryptMedia)) { return Utils.processedEventText(lastEvent) } diff --git a/src/qml/utils.js b/src/qml/utils.js index 9e5177b9..3a5f7405 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -105,7 +105,9 @@ function processedEventText(ev) { if (ev.event_type == "RoomMessageEmote") return coloredNameHtml(ev.sender_name, ev.sender_id) + " " + ev.content - if (ev.event_type.startsWith("RoomMessage")) return ev.content + let unknown = ev.event_type === "RoomMessageUnknown" + + if (ev.event_type.startsWith("RoomMessage") && ! unknown) return ev.content if (ev.event_type.startsWith("RoomEncrypted")) return ev.content let text = qsTr(ev.content).arg(