mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-15 09:24:34 +00:00
Approach the first time to get the new notifications in the frontend
This commit is contained in:
parent
acad4e4c00
commit
d4e5de5eff
@ -106,6 +106,10 @@ describe('notifications', () => {
|
||||
reasonDescription
|
||||
reportedResource {
|
||||
__typename
|
||||
...on User {
|
||||
id
|
||||
name
|
||||
}
|
||||
... on Post {
|
||||
id
|
||||
content
|
||||
@ -114,10 +118,6 @@ describe('notifications', () => {
|
||||
id
|
||||
content
|
||||
}
|
||||
... on User {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,6 +199,10 @@ describe('given some notifications', () => {
|
||||
reasonDescription
|
||||
reportedResource {
|
||||
__typename
|
||||
...on User {
|
||||
id
|
||||
name
|
||||
}
|
||||
...on Post {
|
||||
id
|
||||
title
|
||||
@ -208,10 +212,6 @@ describe('given some notifications', () => {
|
||||
id
|
||||
content
|
||||
}
|
||||
...on User {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -711,7 +711,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
}),
|
||||
reportAgainstDewey.relateTo(dewey, 'belongsTo'),
|
||||
])
|
||||
// notify first reports
|
||||
// notify first report filers
|
||||
await Promise.all([
|
||||
reportAgainstDagobert.relateTo(jennyRostock, 'notified', {
|
||||
read: false,
|
||||
@ -754,7 +754,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
}),
|
||||
reportAgainstTrollingComment.relateTo(trollingComment, 'belongsTo'),
|
||||
])
|
||||
// notify second reports
|
||||
// notify second report filers
|
||||
await Promise.all([
|
||||
reportAgainstDagobert.relateTo(louie, 'notified', {
|
||||
read: false,
|
||||
|
||||
@ -55,15 +55,49 @@ export default {
|
||||
isComment() {
|
||||
return this.from.__typename === 'Comment'
|
||||
},
|
||||
params() {
|
||||
const post = this.isComment ? this.from.post : this.from
|
||||
return {
|
||||
id: post.id,
|
||||
slug: post.slug,
|
||||
sourceData() {
|
||||
let user = null
|
||||
let post = null
|
||||
let comment = null
|
||||
let report = null
|
||||
if (this.from.__typename === 'Post') {
|
||||
post = this.from
|
||||
} else if (this.from.__typename === 'Comment') {
|
||||
comment = this.from
|
||||
post = this.from.post
|
||||
} else if (this.from.__typename === 'Report') {
|
||||
report = {
|
||||
reasonCategory: this.from.filed.reasonCategory,
|
||||
reasonDescription: this.from.filed.reasonDescription,
|
||||
}
|
||||
if (this.from.filed.reportedResource.__typename === 'User') {
|
||||
user = this.from.filed.reportedResource
|
||||
} else if (this.from.filed.reportedResource.__typename === 'Post') {
|
||||
post = this.from.filed.reportedResource
|
||||
} else if (this.from.filed.reportedResource.__typename === 'Comment') {
|
||||
comment = this.from.filed.reportedResource
|
||||
post = this.from.filed.reportedResource.post
|
||||
}
|
||||
}
|
||||
return { user, post, comment, report }
|
||||
},
|
||||
params() {
|
||||
// Wolle const post = this.isComment ? this.from.post : this.from
|
||||
return this.sourceData.user
|
||||
? {
|
||||
id: this.sourceData.user.id,
|
||||
slug: this.sourceData.user.slug,
|
||||
}
|
||||
: this.sourceData.post
|
||||
? {
|
||||
id: this.sourceData.post.id,
|
||||
slug: this.sourceData.post.slug,
|
||||
}
|
||||
: {}
|
||||
},
|
||||
hashParam() {
|
||||
return this.isComment ? { hash: `#commentId-${this.from.id}` } : {}
|
||||
// Wolle return this.isComment ? { hash: `#commentId-${this.from.id}` } : {}
|
||||
return this.sourceData.comment ? { hash: `#commentId-${this.sourceData.comment.id}` } : {}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -89,6 +89,36 @@ export const notificationQuery = i18n => {
|
||||
}
|
||||
}
|
||||
}
|
||||
... on Report {
|
||||
filed {
|
||||
reasonCategory
|
||||
reasonDescription
|
||||
reportedResource {
|
||||
__typename
|
||||
... on User {
|
||||
...user
|
||||
}
|
||||
... on Post {
|
||||
...post
|
||||
author {
|
||||
...user
|
||||
}
|
||||
}
|
||||
... on Comment {
|
||||
...comment
|
||||
author {
|
||||
...user
|
||||
}
|
||||
post {
|
||||
...post
|
||||
author {
|
||||
...user
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user