Merge branch 'notifications-thru-sw' into shigusegubu-vue3
This commit is contained in:
commit
d779da7f3e
5 changed files with 29 additions and 13 deletions
|
@ -57,6 +57,12 @@ const MobileNav = {
|
|||
unseenNotificationsCount () {
|
||||
return this.unseenNotifications.length + countExtraNotifications(this.$store)
|
||||
},
|
||||
unseenCount () {
|
||||
return this.unseenNotifications.length
|
||||
},
|
||||
unseenCountBadgeText () {
|
||||
return `${this.unseenCount ? this.unseenCount : ''}`
|
||||
},
|
||||
hideSitename () { return this.$store.state.instance.hideSitename },
|
||||
sitename () { return this.$store.state.instance.name },
|
||||
isChat () {
|
||||
|
|
|
@ -50,7 +50,13 @@
|
|||
@touchmove.stop="notificationsTouchMove"
|
||||
>
|
||||
<div class="mobile-notifications-header">
|
||||
<span class="title">{{ $t('notifications.notifications') }}</span>
|
||||
<span class="title">
|
||||
{{ $t('notifications.notifications') }}
|
||||
<span
|
||||
v-if="unseenCountBadgeText"
|
||||
class="badge badge-notification unseen-count"
|
||||
>{{ unseenCountBadgeText }}</span>
|
||||
</span>
|
||||
<span class="spacer" />
|
||||
<button
|
||||
v-if="notificationsAtTop"
|
||||
|
@ -69,7 +75,7 @@
|
|||
<button
|
||||
v-if="!closingDrawerMarksAsSeen"
|
||||
class="button-unstyled mobile-nav-button"
|
||||
:title="$t('nav.mobile_notifications_close')"
|
||||
:title="$t('nav.mobile_notifications_mark_as_seen')"
|
||||
@click.stop.prevent="markNotificationsAsSeen()"
|
||||
>
|
||||
<FAIcon
|
||||
|
|
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
|
|
@ -189,6 +189,7 @@
|
|||
"mobile_notifications": "Open notifications",
|
||||
"mobile_notifications": "Open notifications (there are unread ones)",
|
||||
"mobile_notifications_close": "Close notifications",
|
||||
"mobile_notifications_mark_as_seen": "Mark all as seen",
|
||||
"announcements": "Announcements"
|
||||
},
|
||||
"notifications": {
|
||||
|
|
|
@ -73,13 +73,16 @@ const showPushNotification = async (event) => {
|
|||
const res = prepareNotificationObject(parsedNotification, i18n)
|
||||
|
||||
if (state.allowedNotificationTypes.has(parsedNotification.type)) {
|
||||
self.registration.showNotification(res.title, res)
|
||||
return self.registration.showNotification(res.title, res)
|
||||
}
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
self.addEventListener('push', async (event) => {
|
||||
if (event.data) {
|
||||
// Supposedly, we HAVE to return a promise inside waitUntil otherwise it will
|
||||
// show (extra) notification that website is updated in background
|
||||
event.waitUntil(showPushNotification(event))
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue