diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/notification/notification.js | 6 | ||||
| -rw-r--r-- | src/components/notification/notification.vue | 1 | ||||
| -rw-r--r-- | src/components/notifications/notifications.js | 20 | ||||
| -rw-r--r-- | src/components/notifications/notifications.vue | 6 | ||||
| -rw-r--r-- | src/components/status/status.js | 3 | ||||
| -rw-r--r-- | src/components/status/status.vue | 3 |
6 files changed, 38 insertions, 1 deletions
diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 420db4f0..0e938c42 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -50,6 +50,7 @@ const Notification = { } }, props: ['notification'], + emits: ['interacted'], components: { StatusContent, UserAvatar, @@ -72,6 +73,9 @@ const Notification = { getUser (notification) { return this.$store.state.users.usersObject[notification.from_profile.id] }, + interacted () { + this.$emit('interacted') + }, toggleMute () { this.unmuted = !this.unmuted }, @@ -95,6 +99,7 @@ const Notification = { } }, doApprove () { + this.$emit('interacted') this.$store.state.api.backendInteractor.approveUser({ id: this.user.id }) this.$store.dispatch('removeFollowRequest', this.user) this.$store.dispatch('markSingleNotificationAsSeen', { id: this.notification.id }) @@ -114,6 +119,7 @@ const Notification = { } }, doDeny () { + this.$emit('interacted') this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) .then(() => { this.$store.dispatch('dismissNotificationLocal', { id: this.notification.id }) diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 6b3315f9..01ad395f 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -6,6 +6,7 @@ class="Notification" :compact="true" :statusoid="notification.status" + @interacted="interacted" /> </article> <article v-else> diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index 571df0f1..4cbe8093 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -159,6 +159,26 @@ const Notifications = { updateScrollPosition () { this.showScrollTop = this.$refs.root.offsetTop < this.scrollerRef.scrollTop }, + notificationClicked (notification) { + const { type, id, seen } = notification + if (!seen) { + switch (type) { + case 'mention': + case 'pleroma:report': + case 'follow_request': + break + default: + this.markOneAsSeen(id) + } + } + }, + notificationInteracted (notification) { + const { id, seen } = notification + if (!seen) this.markOneAsSeen(id) + }, + markOneAsSeen (id) { + this.$store.dispatch('markSingleNotificationAsSeen', { id }) + }, markAsSeen () { this.$store.dispatch('markNotificationsAsSeen') this.seenToDisplayCount = DEFAULT_SEEN_TO_DISPLAY_COUNT diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index 999f8e9c..27ae23cf 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -67,9 +67,13 @@ role="listitem" class="notification" :class="{unseen: !minimalMode && !notification.seen}" + @click="e => notificationClicked(notification)" > <div class="notification-overlay" /> - <notification :notification="notification" /> + <notification + :notification="notification" + @interacted="e => notificationInteracted(notification)" + /> </div> </div> <div class="panel-footer"> diff --git a/src/components/status/status.js b/src/components/status/status.js index a339694d..129929a3 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -154,6 +154,7 @@ const Status = { 'controlledSetMediaPlaying', 'dive' ], + emits: ['interacted'], data () { return { uncontrolledReplying: false, @@ -442,9 +443,11 @@ const Status = { this.error = error }, clearError () { + this.$emit('interacted') this.error = undefined }, toggleReplying () { + this.$emit('interacted') controlledOrUncontrolledToggle(this, 'replying') }, gotoOriginal (id) { diff --git a/src/components/status/status.vue b/src/components/status/status.vue index d66de562..a8477fa3 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -508,14 +508,17 @@ :visibility="status.visibility" :logged-in="loggedIn" :status="status" + @click="$emit('interacted')" /> <favorite-button :logged-in="loggedIn" :status="status" + @click="$emit('interacted')" /> <ReactButton v-if="loggedIn" :status="status" + @click="$emit('interacted')" /> <extra-buttons :status="status" |
