From e3ee3eaccae6a9ece674d7d76db8e67da499d6c3 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 19 Nov 2023 15:24:34 +0200
Subject: added some settings for notifications

---
 .../settings_modal/tabs/notifications_tab.vue      | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

(limited to 'src/components/settings_modal/tabs/notifications_tab.vue')

diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index 4dfba444..fcee85a0 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -1,5 +1,28 @@
 <template>
   <div :label="$t('settings.notifications')">
+    <div class="setting-item">
+      <h2>{{ $t('settings.notification_setting_annoyance') }}</h2>
+      <ul class="setting-list">
+        <li>
+          <BooleanSetting path="closingDrawerMarksAsSeen">
+            {{ $t('settings.notification_setting_drawer_marks_as_seen') }}
+          </BooleanSetting>
+        </li>
+        <li>
+          <BooleanSetting path="ignoreInactionableSeen">
+            {{ $t('settings.notification_setting_ignore_inactionable_seen') }}
+          </BooleanSetting>
+          <p>
+            {{ $t('settings.notification_setting_ignore_inactionable_seen_tip') }}
+          </p>
+        </li>
+        <li>
+          <BooleanSetting path="unseenAtTop">
+            {{ $t('settings.notification_setting_unseen_at_top') }}
+          </BooleanSetting>
+        </li>
+      </ul>
+    </div>
     <div class="setting-item">
       <h2>{{ $t('settings.notification_setting_filters') }}</h2>
       <ul class="setting-list">
-- 
cgit v1.2.3-70-g09d2


From fd3ad106bed2a5f790556bae200de5c352c5c0ea Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 19 Nov 2023 16:12:43 +0200
Subject: rearrange notification visibility page a bit.

---
 src/components/settings_modal/settings_modal.scss  |  12 ++
 .../settings_modal/tabs/notifications_tab.js       |   4 +
 .../settings_modal/tabs/notifications_tab.vue      | 133 +++++++++++++++++----
 src/i18n/en.json                                   |   3 +
 src/modules/config.js                              |  13 +-
 5 files changed, 139 insertions(+), 26 deletions(-)

(limited to 'src/components/settings_modal/tabs/notifications_tab.vue')

diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss
index 49ef83e0..6bc9459b 100644
--- a/src/components/settings_modal/settings_modal.scss
+++ b/src/components/settings_modal/settings_modal.scss
@@ -3,6 +3,10 @@
 .settings-modal {
   overflow: hidden;
 
+  h4 {
+    margin-bottom: 0.5em;
+  }
+
   .setting-list,
   .option-list {
     list-style-type: none;
@@ -15,6 +19,14 @@
     .suboptions {
       margin-top: 0.3em;
     }
+
+    &.two-column {
+      column-count: 2;
+
+      > li {
+        break-inside: avoid;
+      }
+    }
   }
 
   .setting-description {
diff --git a/src/components/settings_modal/tabs/notifications_tab.js b/src/components/settings_modal/tabs/notifications_tab.js
index 3c6ab87f..c53b5889 100644
--- a/src/components/settings_modal/tabs/notifications_tab.js
+++ b/src/components/settings_modal/tabs/notifications_tab.js
@@ -16,6 +16,10 @@ const NotificationsTab = {
     user () {
       return this.$store.state.users.currentUser
     },
+    canReceiveReports () {
+      if (!this.user) { return false }
+      return this.user.privileges.includes('reports_manage_reports')
+    },
     ...SharedComputedObject()
   },
   methods: {
diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index fcee85a0..00d0f921 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -34,43 +34,128 @@
             {{ $t('settings.notification_setting_block_from_strangers') }}
           </BooleanSetting>
         </li>
-        <li class="select-multiple">
-          <span class="label">{{ $t('settings.notification_visibility') }}</span>
-          <ul class="option-list">
+        <li>
+          <h3> {{ $t('settings.notification_visibility') }}</h3>
+          <ul class="setting-list two-column">
             <li>
-              <BooleanSetting path="notificationVisibility.likes">
-                {{ $t('settings.notification_visibility_likes') }}
-              </BooleanSetting>
+              <h4> {{ $t('settings.notification_visibility_mentions') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.mentions">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.mentions" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
             </li>
             <li>
-              <BooleanSetting path="notificationVisibility.repeats">
-                {{ $t('settings.notification_visibility_repeats') }}
-              </BooleanSetting>
+              <h4> {{ $t('settings.notification_visibility_likes') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.likes">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.likes" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
             </li>
             <li>
-              <BooleanSetting path="notificationVisibility.follows">
-                {{ $t('settings.notification_visibility_follows') }}
-              </BooleanSetting>
+              <h4> {{ $t('settings.notification_visibility_repeats') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.repeats">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.repeats" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
             </li>
             <li>
-              <BooleanSetting path="notificationVisibility.mentions">
-                {{ $t('settings.notification_visibility_mentions') }}
-              </BooleanSetting>
+              <h4> {{ $t('settings.notification_visibility_emoji_reactions') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.emojiReactions">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.emojiReactions" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
             </li>
             <li>
-              <BooleanSetting path="notificationVisibility.moves">
-                {{ $t('settings.notification_visibility_moves') }}
-              </BooleanSetting>
+              <h4> {{ $t('settings.notification_visibility_follows') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.follows">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.follows" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
             </li>
             <li>
-              <BooleanSetting path="notificationVisibility.emojiReactions">
-                {{ $t('settings.notification_visibility_emoji_reactions') }}
-              </BooleanSetting>
+              <h4> {{ $t('settings.notification_visibility_moves') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.moves">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.moves" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
             </li>
             <li>
-              <BooleanSetting path="notificationVisibility.polls">
-                {{ $t('settings.notification_visibility_polls') }}
-              </BooleanSetting>
+              <h4> {{ $t('settings.notification_visibility_polls') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.polls">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.polls" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
+            </li>
+            <li v-if="canReceiveReports">
+              <h4> {{ $t('settings.notification_visibility_reports') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.reports">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.reports" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
             </li>
           </ul>
         </li>
diff --git a/src/i18n/en.json b/src/i18n/en.json
index b31793cb..658e3b8e 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -561,10 +561,13 @@
     "posts": "Posts",
     "user_profiles": "User Profiles",
     "notification_visibility": "Types of notifications to show",
+    "notification_visibility_in_column": "Show in notifications column/drawer",
+    "notification_visibility_native_notifications": "Show a native notification",
     "notification_visibility_follows": "Follows",
     "notification_visibility_likes": "Favorites",
     "notification_visibility_mentions": "Mentions",
     "notification_visibility_repeats": "Repeats",
+    "notification_visibility_reports": "Reports",
     "notification_visibility_moves": "User Migrates",
     "notification_visibility_emoji_reactions": "Reactions",
     "notification_visibility_polls": "Ends of polls you voted in",
diff --git a/src/modules/config.js b/src/modules/config.js
index a3f7bcaf..db1d564e 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -66,8 +66,17 @@ export const defaultState = {
     chatMention: true,
     polls: true
   },
-  notificationSettings: {
-    nativeNotifications: ['follows', 'mentions', 'followRequest', 'reports', 'chatMention', 'polls']
+  notificationNative: {
+    follows: true,
+    mentions: true,
+    likes: false,
+    repeats: false,
+    moves: false,
+    emojiReactions: false,
+    followRequest: true,
+    reports: true,
+    chatMention: true,
+    polls: true
   },
   webPushNotifications: false,
   muteWords: [],
-- 
cgit v1.2.3-70-g09d2


From d178a56924dfd3dec180270fa197493b3a505780 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 19 Nov 2023 16:14:24 +0200
Subject: improve visual for the description bit

---
 src/components/settings_modal/tabs/notifications_tab.vue | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/components/settings_modal/tabs/notifications_tab.vue')

diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index 00d0f921..ffaa5723 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -12,9 +12,11 @@
           <BooleanSetting path="ignoreInactionableSeen">
             {{ $t('settings.notification_setting_ignore_inactionable_seen') }}
           </BooleanSetting>
-          <p>
-            {{ $t('settings.notification_setting_ignore_inactionable_seen_tip') }}
-          </p>
+          <div>
+            <small>
+              {{ $t('settings.notification_setting_ignore_inactionable_seen_tip') }}
+            </small>
+          </div>
         </li>
         <li>
           <BooleanSetting path="unseenAtTop">
-- 
cgit v1.2.3-70-g09d2


From 072a06fc89844a5ed2f557634b7e04c1ef63041d Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 19 Nov 2023 16:40:30 +0200
Subject: reports visibility setting + actual filtering for desktop notifs

---
 .../settings_modal/tabs/notifications_tab.vue      | 15 +++++++
 src/i18n/en.json                                   |  1 +
 .../notification_utils/notification_utils.js       |  1 +
 src/sw.js                                          | 51 ++++++++++++++++++----
 4 files changed, 59 insertions(+), 9 deletions(-)

(limited to 'src/components/settings_modal/tabs/notifications_tab.vue')

diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index ffaa5723..a6f0cba2 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -114,6 +114,21 @@
                 </li>
               </ul>
             </li>
+            <li>
+              <h4> {{ $t('settings.notification_visibility_follow_requests') }}</h4>
+              <ul class="setting-list">
+                <li>
+                  <BooleanSetting path="notificationVisibility.follow_request">
+                    {{ $t('settings.notification_visibility_in_column') }}
+                  </BooleanSetting>
+                </li>
+                <li>
+                  <BooleanSetting path="notificationNative.follow_request" >
+                    {{ $t('settings.notification_visibility_native_notifications') }}
+                  </BooleanSetting>
+                </li>
+              </ul>
+            </li>
             <li>
               <h4> {{ $t('settings.notification_visibility_moves') }}</h4>
               <ul class="setting-list">
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 658e3b8e..40da7155 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -564,6 +564,7 @@
     "notification_visibility_in_column": "Show in notifications column/drawer",
     "notification_visibility_native_notifications": "Show a native notification",
     "notification_visibility_follows": "Follows",
+    "notification_visibility_follow_requests": "Follow requests",
     "notification_visibility_likes": "Favorites",
     "notification_visibility_mentions": "Mentions",
     "notification_visibility_repeats": "Repeats",
diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js
index 342fe6ef..cc7e6817 100644
--- a/src/services/notification_utils/notification_utils.js
+++ b/src/services/notification_utils/notification_utils.js
@@ -91,6 +91,7 @@ export const prepareNotificationObject = (notification, i18n) => {
 
   const notifObj = {
     tag: notification.id,
+    type: notification.type,
     badge: cachedBadgeUrl
   }
   const status = notification.status
diff --git a/src/sw.js b/src/sw.js
index f5fccc6a..469291b9 100644
--- a/src/sw.js
+++ b/src/sw.js
@@ -15,7 +15,8 @@ const i18n = createI18n({
 
 const state = {
   lastFocused: null,
-  notificationIds: new Set()
+  notificationIds: new Set(),
+  allowedNotificationTypes: null
 }
 
 function getWindowClients () {
@@ -23,15 +24,43 @@ function getWindowClients () {
     .then((clientList) => clientList.filter(({ type }) => type === 'window'))
 }
 
-const setLocale = async () => {
-  const state = await localForage.getItem('vuex-lz')
-  const locale = state.config.interfaceLanguage || 'en'
+const setSettings = async () => {
+  const vuexState = await localForage.getItem('vuex-lz')
+  const locale = vuexState.config.interfaceLanguage || 'en'
   i18n.locale = locale
+  const notificationsNativeArray = Object.entries(vuexState.config.notificationNative)
+
+  state.allowedNotificationTypes = new Set(
+    notificationsNativeArray
+      .filter(([k, v]) => v)
+      .map(([k]) => {
+        switch (k) {
+          case 'mentions':
+            return 'mention'
+          case 'likes':
+            return 'like'
+          case 'repeats':
+            return 'repeat'
+          case 'emojiReactions':
+            return 'pleroma:emoji_reaction'
+          case 'reports':
+            return 'pleroma:report'
+          case 'followRequest':
+            return 'follow_request'
+          case 'follows':
+            return 'follow'
+          case 'polls':
+            return 'poll'
+          default:
+            return k
+        }
+      })
+  )
 }
 
 const showPushNotification = async (event) => {
   const activeClients = await getWindowClients()
-  await setLocale()
+  await setSettings()
   // Only show push notifications if all tabs/windows are closed
   if (activeClients.length === 0) {
     const data = event.data.json()
@@ -43,27 +72,31 @@ const showPushNotification = async (event) => {
 
     const res = prepareNotificationObject(parsedNotification, i18n)
 
-    self.registration.showNotification(res.title, res)
+    if (state.allowedNotificationTypes.has(parsedNotification.type)) {
+      self.registration.showNotification(res.title, res)
+    }
   }
 }
 
 self.addEventListener('push', async (event) => {
-  console.log(event)
   if (event.data) {
     event.waitUntil(showPushNotification(event))
   }
 })
 
 self.addEventListener('message', async (event) => {
+  await setSettings()
   const { type, content } = event.data
 
   if (type === 'desktopNotification') {
     const { title, ...rest } = content
-    const { tag } = rest
+    const { tag, type } = rest
     if (state.notificationIds.has(tag)) return
     state.notificationIds.add(tag)
     setTimeout(() => state.notificationIds.delete(tag), 10000)
-    self.registration.showNotification(title, rest)
+    if (state.allowedNotificationTypes.has(type)) {
+      self.registration.showNotification(title, rest)
+    }
   }
 
   if (type === 'desktopNotificationClose') {
-- 
cgit v1.2.3-70-g09d2


From febc2aa5690e9658970da69ea58fce40682ee0a2 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Wed, 13 Dec 2023 20:56:27 +0200
Subject: lint

---
 .../settings_modal/tabs/notifications_tab.vue          | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'src/components/settings_modal/tabs/notifications_tab.vue')

diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index a6f0cba2..020666ff 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -48,7 +48,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.mentions" >
+                  <BooleanSetting path="notificationNative.mentions">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -63,7 +63,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.likes" >
+                  <BooleanSetting path="notificationNative.likes">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -78,7 +78,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.repeats" >
+                  <BooleanSetting path="notificationNative.repeats">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -93,7 +93,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.emojiReactions" >
+                  <BooleanSetting path="notificationNative.emojiReactions">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -108,7 +108,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.follows" >
+                  <BooleanSetting path="notificationNative.follows">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -123,7 +123,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.follow_request" >
+                  <BooleanSetting path="notificationNative.follow_request">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -138,7 +138,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.moves" >
+                  <BooleanSetting path="notificationNative.moves">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -153,7 +153,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.polls" >
+                  <BooleanSetting path="notificationNative.polls">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
@@ -168,7 +168,7 @@
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.reports" >
+                  <BooleanSetting path="notificationNative.reports">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
-- 
cgit v1.2.3-70-g09d2


From b394392d0d6d73dacb878a25dd0b25676ef72635 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Wed, 13 Dec 2023 21:07:23 +0200
Subject: fix incorrect path for follow request notifications settings

---
 src/components/settings_modal/tabs/notifications_tab.vue | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/components/settings_modal/tabs/notifications_tab.vue')

diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index 020666ff..3083abe0 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -118,12 +118,12 @@
               <h4> {{ $t('settings.notification_visibility_follow_requests') }}</h4>
               <ul class="setting-list">
                 <li>
-                  <BooleanSetting path="notificationVisibility.follow_request">
+                  <BooleanSetting path="notificationVisibility.followRequest">
                     {{ $t('settings.notification_visibility_in_column') }}
                   </BooleanSetting>
                 </li>
                 <li>
-                  <BooleanSetting path="notificationNative.follow_request">
+                  <BooleanSetting path="notificationNative.followRequest">
                     {{ $t('settings.notification_visibility_native_notifications') }}
                   </BooleanSetting>
                 </li>
-- 
cgit v1.2.3-70-g09d2


From 5ee8fc0aeadb59c6f78d0c8c8e725072ad9cdc54 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Wed, 13 Dec 2023 23:54:12 +0200
Subject: add setting to always show push notifications

---
 .../settings_modal/tabs/notifications_tab.vue          | 18 +++++++++++++++++-
 src/i18n/en.json                                       |  3 +++
 src/modules/config.js                                  |  1 +
 src/sw.js                                              |  5 +++--
 4 files changed, 24 insertions(+), 3 deletions(-)

(limited to 'src/components/settings_modal/tabs/notifications_tab.vue')

diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index 3083abe0..9ace4c36 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -19,7 +19,7 @@
           </div>
         </li>
         <li>
-          <BooleanSetting path="unseenAtTop">
+          <BooleanSetting path="unseenAtTop" expert="1">
             {{ $t('settings.notification_setting_unseen_at_top') }}
           </BooleanSetting>
         </li>
@@ -38,6 +38,7 @@
         </li>
         <li>
           <h3> {{ $t('settings.notification_visibility') }}</h3>
+          <p v-if="expertLevel > 0">{{ $t('settings.notification_setting_filters_chrome_push') }}</p>
           <ul class="setting-list two-column">
             <li>
               <h4> {{ $t('settings.notification_visibility_mentions') }}</h4>
@@ -233,6 +234,21 @@
           >
             {{ $t('settings.enable_web_push_notifications') }}
           </BooleanSetting>
+          <ul class="setting-list suboptions">
+            <li>
+              <BooleanSetting
+                path="webPushAlwaysShowNotifications"
+                :disabled="!mergedConfig.webPushNotifications"
+              >
+                {{ $t('settings.enable_web_push_always_show') }}
+              </BooleanSetting>
+              <div :class="{ faint: !mergedConfig.webPushNotifications }">
+                <small>
+                  {{ $t('settings.enable_web_push_always_show_tip') }}
+                </small>
+              </div>
+            </li>
+          </ul>
         </li>
         <li>
           <BooleanSetting
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 195b5e07..ed828a62 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -699,12 +699,15 @@
     "notification_setting_ignore_inactionable_seen_tip": "This will not actually mark those notifications as read, and you'll still get desktop notifications about them if you chose so",
     "notification_setting_unseen_at_top": "Show unread notifications above others",
     "notification_setting_filters": "Filters",
+    "notification_setting_filters_chrome_push": "On some browsers (chrome) it might be impossible to completely filter out notifications by type when they arrive by Push",
     "notification_setting_block_from_strangers": "Block notifications from users who you do not follow",
     "notification_setting_privacy": "Privacy",
     "notification_setting_hide_notification_contents": "Hide the sender and contents of push notifications",
     "notification_mutes": "To stop receiving notifications from a specific user, use a mute.",
     "notification_blocks": "Blocking a user stops all notifications as well as unsubscribes them.",
     "enable_web_push_notifications": "Enable web push notifications",
+    "enable_web_push_always_show": "Always show web push notifications",
+    "enable_web_push_always_show_tip": "Some browsers (Chromium, Chrome) require that push messages always result in a notification, otherwise generic 'Website was updated in background' is shown, enable this to prevent this notification from showing. Can result in showing duplicate notifications on other browsers.",
     "more_settings": "More settings",
     "style": {
       "switcher": {
diff --git a/src/modules/config.js b/src/modules/config.js
index db1d564e..abb57272 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -79,6 +79,7 @@ export const defaultState = {
     polls: true
   },
   webPushNotifications: false,
+  webPushAlwaysShowNotifications: false,
   muteWords: [],
   highlight: {},
   interfaceLanguage: browserLocale,
diff --git a/src/sw.js b/src/sw.js
index 86f6e694..4ee7b9ff 100644
--- a/src/sw.js
+++ b/src/sw.js
@@ -29,6 +29,7 @@ const setSettings = async () => {
   const locale = vuexState.config.interfaceLanguage || 'en'
   i18n.locale = locale
   const notificationsNativeArray = Object.entries(vuexState.config.notificationNative)
+  state.webPushAlwaysShowNotifications = vuexState.config.webPushAlwaysShowNotifications
 
   state.allowedNotificationTypes = new Set(
     notificationsNativeArray
@@ -62,7 +63,7 @@ const showPushNotification = async (event) => {
   const activeClients = await getWindowClients()
   await setSettings()
   // Only show push notifications if all tabs/windows are closed
-  if (activeClients.length === 0) {
+  if (state.webPushAlwaysShowNotifications || activeClients.length === 0) {
     const data = event.data.json()
 
     const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}`
@@ -72,7 +73,7 @@ const showPushNotification = async (event) => {
 
     const res = prepareNotificationObject(parsedNotification, i18n)
 
-    if (state.allowedNotificationTypes.has(parsedNotification.type)) {
+    if (state.webPushAlwaysShowNotifications || state.allowedNotificationTypes.has(parsedNotification.type)) {
       return self.registration.showNotification(res.title, res)
     }
   }
-- 
cgit v1.2.3-70-g09d2

