Merge branch 'notifications-thru-sw' into shigusegubu-vue3
This commit is contained in:
commit
1c2f470e73
23 changed files with 288 additions and 44 deletions
|
|
@ -14,7 +14,8 @@ import {
|
|||
faBell,
|
||||
faBars,
|
||||
faArrowUp,
|
||||
faMinus
|
||||
faMinus,
|
||||
faCheckDouble
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
library.add(
|
||||
|
|
@ -22,7 +23,8 @@ library.add(
|
|||
faBell,
|
||||
faBars,
|
||||
faArrowUp,
|
||||
faMinus
|
||||
faMinus,
|
||||
faCheckDouble
|
||||
)
|
||||
|
||||
const MobileNav = {
|
||||
|
|
@ -67,6 +69,9 @@ const MobileNav = {
|
|||
shouldConfirmLogout () {
|
||||
return this.$store.getters.mergedConfig.modalOnLogout
|
||||
},
|
||||
closingDrawerMarksAsSeen () {
|
||||
return this.$store.getters.mergedConfig.closingDrawerMarksAsSeen
|
||||
},
|
||||
...mapGetters(['unreadChatCount'])
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -81,7 +86,7 @@ const MobileNav = {
|
|||
// make sure to mark notifs seen only when the notifs were open and not
|
||||
// from close-calls.
|
||||
this.notificationsOpen = false
|
||||
if (markRead) {
|
||||
if (markRead && this.closingDrawerMarksAsSeen) {
|
||||
this.markNotificationsAsSeen()
|
||||
}
|
||||
}
|
||||
|
|
@ -117,7 +122,6 @@ const MobileNav = {
|
|||
this.hideConfirmLogout()
|
||||
},
|
||||
markNotificationsAsSeen () {
|
||||
// this.$refs.notifications.markAsSeen()
|
||||
this.$store.dispatch('markNotificationsAsSeen')
|
||||
},
|
||||
onScroll ({ target: { scrollTop, clientHeight, scrollHeight } }) {
|
||||
|
|
|
|||
|
|
@ -66,6 +66,17 @@
|
|||
/>
|
||||
</FALayers>
|
||||
</button>
|
||||
<button
|
||||
v-if="!closingDrawerMarksAsSeen"
|
||||
class="button-unstyled mobile-nav-button"
|
||||
:title="$t('nav.mobile_notifications_close')"
|
||||
@click.stop.prevent="markNotificationsAsSeen()"
|
||||
>
|
||||
<FAIcon
|
||||
class="fa-scale-110 fa-old-padding"
|
||||
icon="check-double"
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
class="button-unstyled mobile-nav-button"
|
||||
:title="$t('nav.mobile_notifications_close')"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ library.add(
|
|||
)
|
||||
|
||||
const DEFAULT_SEEN_TO_DISPLAY_COUNT = 30
|
||||
const ACTIONABLE_NOTIFICATION_TYPES = new Set(['mention', 'pleroma:report', 'follow_request'])
|
||||
|
||||
const Notifications = {
|
||||
components: {
|
||||
|
|
@ -71,14 +72,26 @@ const Notifications = {
|
|||
return unseenNotificationsFromStore(this.$store)
|
||||
},
|
||||
filteredNotifications () {
|
||||
return filteredNotificationsFromStore(this.$store, this.filterMode)
|
||||
if (this.unseenAtTop) {
|
||||
return [
|
||||
...filteredNotificationsFromStore(this.$store).filter(n => this.shouldShowUnseen(n)),
|
||||
...filteredNotificationsFromStore(this.$store).filter(n => !this.shouldShowUnseen(n))
|
||||
]
|
||||
} else {
|
||||
return filteredNotificationsFromStore(this.$store, this.filterMode)
|
||||
}
|
||||
},
|
||||
unseenCountBadgeText () {
|
||||
return `${this.unseenCount ? this.unseenCount : ''}${this.extraNotificationsCount ? '*' : ''}`
|
||||
},
|
||||
unseenCount () {
|
||||
return this.unseenNotifications.length
|
||||
if (this.ignoreInactionableSeen) {
|
||||
return this.unseenNotifications.filter(n => ACTIONABLE_NOTIFICATION_TYPES.has(n.type)).length
|
||||
} else {
|
||||
return this.unseenNotifications.length
|
||||
}
|
||||
},
|
||||
ignoreInactionableSeen () { return this.$store.getters.mergedConfig.ignoreInactionableSeen },
|
||||
extraNotificationsCount () {
|
||||
return countExtraNotifications(this.$store)
|
||||
},
|
||||
|
|
@ -108,6 +121,7 @@ const Notifications = {
|
|||
return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount)
|
||||
},
|
||||
noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
|
||||
unseenAtTop () { return this.$store.getters.mergedConfig.unseenAtTop },
|
||||
showExtraNotifications () {
|
||||
return !this.noExtra
|
||||
},
|
||||
|
|
@ -154,11 +168,16 @@ const Notifications = {
|
|||
scrollToTop () {
|
||||
const scrollable = this.scrollerRef
|
||||
scrollable.scrollTo({ top: this.$refs.root.offsetTop })
|
||||
// this.$refs.root.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
},
|
||||
updateScrollPosition () {
|
||||
this.showScrollTop = this.$refs.root.offsetTop < this.scrollerRef.scrollTop
|
||||
},
|
||||
shouldShowUnseen (notification) {
|
||||
if (notification.seen) return false
|
||||
|
||||
const actionable = ACTIONABLE_NOTIFICATION_TYPES.has(notification.type)
|
||||
return this.ignoreInactionableSeen ? actionable : true
|
||||
},
|
||||
/* "Interacted" really refers to "actionable" notifications that require user input,
|
||||
* everything else (likes/repeats/reacts) cannot be acted and therefore we just clear
|
||||
* the "seen" status upon any clicks on them
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
:key="notification.id"
|
||||
role="listitem"
|
||||
class="notification"
|
||||
:class="{unseen: !minimalMode && !notification.seen}"
|
||||
:class="{unseen: !minimalMode && shouldShowUnseen(notification)}"
|
||||
@click="e => notificationClicked(notification)"
|
||||
>
|
||||
<div class="notification-overlay" />
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,30 @@
|
|||
<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>
|
||||
<div>
|
||||
<small>
|
||||
{{ $t('settings.notification_setting_ignore_inactionable_seen_tip') }}
|
||||
</small>
|
||||
</div>
|
||||
</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">
|
||||
|
|
@ -11,43 +36,143 @@
|
|||
{{ $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_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>
|
||||
<BooleanSetting path="notificationVisibility.polls">
|
||||
{{ $t('settings.notification_visibility_polls') }}
|
||||
</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>
|
||||
<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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue