related user for group notifications

This commit is contained in:
Moriz Wahl 2023-03-15 17:49:52 +01:00
parent 997dff4dec
commit ab58c569d0
3 changed files with 7 additions and 7 deletions

View File

@ -1,12 +1,12 @@
<template> <template>
<article :class="{ '--read': notification.read, notification: true }"> <article :class="{ '--read': notification.read, notification: true }">
<client-only> <client-only>
<user-teaser :user="isGroup ? to : from.author" :date-time="from.createdAt" /> <user-teaser :user="isGroup ? notification.relatedUser : from.author" :date-time="from.createdAt" />
</client-only> </client-only>
<p class="description">{{ $t(`notifications.reason.${notification.reason}`) }}</p> <p class="description">{{ $t(`notifications.reason.${notification.reason}`) }}</p>
<nuxt-link <nuxt-link
class="link" class="link"
:to="{ name: isGroup ? 'group' : 'post-id-slug', params, hashParam }" :to="{ name: isGroup ? 'group-id-slug' : 'post-id-slug', params, hashParam }"
@click.native="$emit('read')" @click.native="$emit('read')"
> >
<base-card wideContent> <base-card wideContent>
@ -38,9 +38,6 @@ export default {
from() { from() {
return this.notification.from return this.notification.from
}, },
to() {
return this.notification.to
},
isComment() { isComment() {
return this.from.__typename === 'Comment' return this.from.__typename === 'Comment'
}, },

View File

@ -40,7 +40,7 @@
<client-only> <client-only>
<user-teaser <user-teaser
:user=" :user="
isGroup(notification.from) ? notification.to : notification.from.author isGroup(notification.from) ? notification.relatedUser : notification.from.author
" "
:date-time="notification.from.createdAt" :date-time="notification.from.createdAt"
:class="{ 'notification-status': notification.read }" :class="{ 'notification-status': notification.read }"
@ -63,7 +63,7 @@
class="notification-mention-post" class="notification-mention-post"
:class="{ 'notification-status': notification.read }" :class="{ 'notification-status': notification.read }"
:to="{ :to="{
name: isGroup(notification.from) ? 'group' : 'post-id-slug', name: isGroup(notification.from) ? 'group-id-slug' : 'post-id-slug',
params: params(notification.from), params: params(notification.from),
hash: hashParam(notification.from), hash: hashParam(notification.from),
}" }"

View File

@ -150,6 +150,9 @@ export const notificationQuery = (_i18n) => {
...group ...group
} }
} }
relatedUser {
...user
}
} }
} }
` `