diff --git a/webapp/components/notifications/Notification/Notification.vue b/webapp/components/notifications/Notification/Notification.vue index 193b5f67b..31b61be40 100644 --- a/webapp/components/notifications/Notification/Notification.vue +++ b/webapp/components/notifications/Notification/Notification.vue @@ -2,13 +2,7 @@ - - + {{ $t(`notifications.menu.${notification.reason}`) }} @@ -22,16 +16,15 @@ > -
{{ post.contentExcerpt | removeHtml }}
-
- Comment: - {{ comment.contentExcerpt | removeHtml }} +
+ Comment: + {{ from.contentExcerpt | removeHtml }}
@@ -54,23 +47,21 @@ export default { }, }, computed: { - resourceType() { - return this.post.id ? 'Post' : 'Comment' + from() { + return this.notification.from }, - post() { - return this.notification.post || {} - }, - comment() { - return this.notification.comment || {} + isComment() { + return this.from.__typename === 'Comment' }, params() { + const post = this.isComment ? this.from.post : this.from return { - id: this.post.id || this.comment.post.id, - slug: this.post.slug || this.comment.post.slug, + id: post.id, + slug: post.slug, } }, hashParam() { - return this.post.id ? {} : { hash: `#commentId-${this.comment.id}` } + return this.isComment ? { hash: `#commentId-${this.from.id}` } : {} }, }, } diff --git a/webapp/components/notifications/NotificationList/NotificationList.vue b/webapp/components/notifications/NotificationList/NotificationList.vue index 43783ea56..aac040785 100644 --- a/webapp/components/notifications/NotificationList/NotificationList.vue +++ b/webapp/components/notifications/NotificationList/NotificationList.vue @@ -4,7 +4,7 @@ v-for="notification in notifications" :key="notification.id" :notification="notification" - @read="markAsRead(notification.id)" + @read="markAsRead(notification.from.id)" />
@@ -24,8 +24,8 @@ export default { }, }, methods: { - markAsRead(notificationId) { - this.$emit('markAsRead', notificationId) + async markAsRead(notificationSourceId) { + this.$emit('markAsRead', notificationSourceId) }, }, } diff --git a/webapp/components/notifications/NotificationMenu/NotificationMenu.vue b/webapp/components/notifications/NotificationMenu/NotificationMenu.vue index c534f2986..8dc496efc 100644 --- a/webapp/components/notifications/NotificationMenu/NotificationMenu.vue +++ b/webapp/components/notifications/NotificationMenu/NotificationMenu.vue @@ -18,7 +18,7 @@