fix(@desktop/chat): hide notification when leaving/creating a group

fixes #2484
This commit is contained in:
Anthony Laibe 2021-07-22 13:52:15 +02:00 committed by Iuri Matias
parent 3576cbc229
commit e88665f27a
2 changed files with 4 additions and 6 deletions

View File

@ -255,9 +255,10 @@ QtObject:
discard self.status.chat.markMessagesSeen(msg.chatId, @[msg.id]) discard self.status.chat.markMessagesSeen(msg.chatId, @[msg.id])
self.newMessagePushed() self.newMessagePushed()
if not channel.muted: let isGroupSelf = msg.fromAuthor == self.pubKey and msg.contentType == ContentType.Group
let isEdit = msg.editedAt != "0" or msg.contentType == ContentType.Edit
if not channel.muted and not isEdit and not isGroupSelf:
let isAddedContact = channel.chatType.isOneToOne and self.isAddedContact(channel.id) 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.contentType.int, 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) = proc markMessageAsSent*(self:MessageView, chat: string, messageId: string) =

View File

@ -590,9 +590,6 @@ Item {
target: chatsModel.messageView target: chatsModel.messageView
onMessageNotificationPushed: function(chatId, msg, contentType, chatType, timestamp, identicon, username, hasMention, isAddedContact, channelName) { onMessageNotificationPushed: function(chatId, msg, contentType, chatType, timestamp, identicon, username, hasMention, isAddedContact, channelName) {
if (contentType == Constants.editType)
return;
if (appSettings.notificationSetting == Constants.notifyAllMessages || if (appSettings.notificationSetting == Constants.notifyAllMessages ||
(appSettings.notificationSetting == Constants.notifyJustMentions && hasMention)) { (appSettings.notificationSetting == Constants.notifyJustMentions && hasMention)) {
if (chatId === chatsModel.channelView.activeChannel.id && applicationWindow.active === true) { if (chatId === chatsModel.channelView.activeChannel.id && applicationWindow.active === true) {