From a90257e141c31840b144abc628d49c5ad5a9a9ca Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 17 May 2021 16:15:34 -0400 Subject: [PATCH] feat: add setting for notifications on requests --- ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml | 3 --- ui/app/AppLayouts/Chat/ContactsColumn.qml | 3 +++ .../AppLayouts/Profile/Sections/NotificationsContainer.qml | 7 +++---- ui/app/AppMain.qml | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml index a5647f67bb..768b98360e 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml @@ -184,9 +184,6 @@ ScrollView { onMessageNotificationPushed: function(chatId, msg, messageType, chatType, timestamp, identicon, username, hasMention, isAddedContact, channelName) { if (appSettings.notificationSetting == Constants.notifyAllMessages || (appSettings.notificationSetting == Constants.notifyJustMentions && hasMention)) { - 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 diff --git a/ui/app/AppLayouts/Chat/ContactsColumn.qml b/ui/app/AppLayouts/Chat/ContactsColumn.qml index 1e0990736c..610ed84bfe 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn.qml @@ -122,6 +122,9 @@ Rectangle { Connections { target: profileModel.contacts onContactRequestAdded: { + if (!appSettings.notifyOnNewRequests) { + return + } systemTray.showMessage(qsTr("New contact request"), qsTr("%1 requests to become contacts").arg(Utils.removeStatusEns(name)), SystemTrayIcon.NoIcon, diff --git a/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml b/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml index 2806b15923..7fbecf8dcc 100644 --- a/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml @@ -253,12 +253,11 @@ ScrollView { width: parent.width StatusSettingsLineButton { - //% "Receive notifications from non-contacts" - text: qsTrId("receive-notifications-from-non-contacts") + text: qsTr("Notify on new requests") isSwitch: true - switchChecked: appSettings.allowNotificationsFromNonContacts + switchChecked: appSettings.notifyOnNewRequests onClicked: { - appSettings.allowNotificationsFromNonContacts = checked + appSettings.notifyOnNewRequests = checked } } diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 42f80efc70..c0b63faf8e 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -123,7 +123,7 @@ RowLayout { property bool notificationSoundsEnabled: true property bool useOSNotifications: true property int notificationMessagePreviewSetting: Constants.notificationPreviewNameAndMessage - property bool allowNotificationsFromNonContacts: false + property bool notifyOnNewRequests: true property var whitelistedUnfurlingSites: ({}) property bool neverAskAboutUnfurlingAgain: false property bool hideChannelSuggestions: false