fix: show notification if the window isn't focused

This commit is contained in:
Jonathan Rainville 2020-12-28 10:45:46 -05:00 committed by Iuri Matias
parent 7e1d7be314
commit 6afe9088e9
2 changed files with 20 additions and 15 deletions

View File

@ -260,21 +260,21 @@ QtObject:
self.messageList[msg.chatId].add(msg)
self.messagePushed()
if self.channelOpenTime.getOrDefault(msg.chatId, high(int64)) < msg.timestamp.parseFloat.fromUnixFloat.toUnix:
if msg.chatId != self.activeChannel.id:
let channel = self.chats.getChannelById(msg.chatId)
let isAddedContact = channel.chatType.isOneToOne and self.status.contacts.isAdded(channel.id)
if not channel.muted:
self.messageNotificationPushed(
msg.chatId,
escape_html(msg.text),
msg.messageType,
channel.chatType.int,
msg.timestamp,
msg.identicon,
msg.alias,
msg.hasMention,
isAddedContact,
channel.name)
let channel = self.chats.getChannelById(msg.chatId)
let isAddedContact = channel.chatType.isOneToOne and self.status.contacts.isAdded(channel.id)
if not channel.muted:
self.messageNotificationPushed(
msg.chatId,
escape_html(msg.text),
msg.messageType,
channel.chatType.int,
msg.timestamp,
msg.identicon,
msg.alias,
msg.hasMention,
isAddedContact,
channel.name)
else:
discard self.status.chat.markMessagesSeen(msg.chatId, @[msg.id])
self.newMessagePushed()

View File

@ -163,6 +163,11 @@ ScrollView {
if (chatType === Constants.chatTypeOneToOne && !appSettings.allowNotificationsFromNonContacts && !isAddedContact) {
return
}
if (chatId === chatsModel.activeChannel.id && applicationWindow.active === true) {
// Do not show the notif if we are in the channel already and the window is active and focused
return
}
chatLogView.currentNotificationChatId = chatId
let name;