From 511c9591210a3d10150b5271507814b1fafc4cb2 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Wed, 14 Jul 2021 11:22:00 +0200 Subject: [PATCH] fix(@desktop/chat): fix sticker/image notification with placeholder fixes #2450 --- src/app/chat/views/messages.nim | 4 ++-- ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/chat/views/messages.nim b/src/app/chat/views/messages.nim index 99de9ef6f0..d3c856c268 100644 --- a/src/app/chat/views/messages.nim +++ b/src/app/chat/views/messages.nim @@ -223,7 +223,7 @@ QtObject: proc isAddedContact*(self: MessageView, id: string): bool {.slot.} = result = self.status.contacts.isAdded(id) - proc messageNotificationPushed*(self: MessageView, chatId: string, text: string, messageType: string, chatType: int, timestamp: string, identicon: string, username: string, hasMention: bool, isAddedContact: bool, channelName: string) {.signal.} + proc messageNotificationPushed*(self: MessageView, chatId: string, text: string, contentType: int, chatType: int, timestamp: string, identicon: string, username: string, hasMention: bool, isAddedContact: bool, channelName: string) {.signal.} proc pushMessages*(self:MessageView, messages: var seq[Message]) = for msg in messages.mitems: @@ -259,7 +259,7 @@ QtObject: if not channel.muted: let isAddedContact = channel.chatType.isOneToOne and self.isAddedContact(channel.id) if msg.editedAt == "0": # Do not push notifications for edit messages - self.messageNotificationPushed(msg.chatId, escape_html(msg.text), msg.messageType, channel.chatType.int, msg.timestamp, msg.identicon, msg.userName, msg.hasMention, isAddedContact, channel.name) + self.messageNotificationPushed(msg.chatId, escape_html(msg.text), msg.contentType.int, channel.chatType.int, msg.timestamp, msg.identicon, msg.userName, msg.hasMention, isAddedContact, channel.name) proc markMessageAsSent*(self:MessageView, chat: string, messageId: string) = if self.messageList.contains(chat): diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml index 0cd6442840..2324f3beec 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml @@ -206,8 +206,9 @@ SplitView { } } - onMessageNotificationPushed: function(chatId, msg, messageType, chatType, timestamp, identicon, username, hasMention, isAddedContact, channelName) { - if (messageType == Constants.editType) return; + onMessageNotificationPushed: function(chatId, msg, contentType, chatType, timestamp, identicon, username, hasMention, isAddedContact, channelName) { + if (contentType == Constants.editType) return; + if (appSettings.notificationSetting == Constants.notifyAllMessages || (appSettings.notificationSetting == Constants.notifyJustMentions && hasMention)) { if (chatId === chatsModel.channelView.activeChannel.id && applicationWindow.active === true) { @@ -229,7 +230,7 @@ SplitView { let message; if (appSettings.notificationMessagePreviewSetting > Constants.notificationPreviewNameOnly) { - switch(messageType){ + switch(contentType){ //% "Image" case Constants.imageType: message = qsTrId("image"); break //% "Sticker"