Fix RoomMessageUnknown not seen as general event

This commit is contained in:
miruka 2019-12-04 18:27:56 -04:00
parent 9d89409379
commit b3f93b969c
2 changed files with 10 additions and 6 deletions

View File

@ -67,11 +67,13 @@ HTileDelegate {
subtitle.text: { subtitle.text: {
if (! lastEvent) return "" if (! lastEvent) return ""
// If it's an emote or non-message/media event let isEmote = lastEvent.event_type === "RoomMessageEmote"
if (lastEvent.event_type === "RoomMessageEmote" || let isMsg = lastEvent.event_type.startsWith("RoomMessage")
(! lastEvent.event_type.startsWith("RoomMessage") && let isUnknownMsg = lastEvent.event_type === "RoomMessageUnknown"
! lastEvent.event_type.startsWith("RoomEncrypted"))) let isCryptMedia = lastEvent.event_type.startsWith("RoomEncrypted")
{
// If it's a general event
if (isEmote || isUnknownMsg || (! isMsg && ! isCryptMedia)) {
return Utils.processedEventText(lastEvent) return Utils.processedEventText(lastEvent)
} }

View File

@ -105,7 +105,9 @@ function processedEventText(ev) {
if (ev.event_type == "RoomMessageEmote") if (ev.event_type == "RoomMessageEmote")
return coloredNameHtml(ev.sender_name, ev.sender_id) + " " + ev.content 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 if (ev.event_type.startsWith("RoomEncrypted")) return ev.content
let text = qsTr(ev.content).arg( let text = qsTr(ev.content).arg(