mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refine notification behaviour:
If you mark a post or comment as read even though you already marked the corresponding notification as read, then you receive `null`.
This commit is contained in:
parent
2846a6a8d3
commit
3f121c7c4d
@ -62,7 +62,7 @@ export default {
|
||||
let notification
|
||||
try {
|
||||
const cypher = `
|
||||
MATCH (resource {id: $resourceId})-[notification:NOTIFIED]->(user:User {id:$id})
|
||||
MATCH (resource {id: $resourceId})-[notification:NOTIFIED {read: FALSE}]->(user:User {id:$id})
|
||||
SET notification.read = TRUE
|
||||
RETURN resource, notification, user
|
||||
`
|
||||
|
||||
@ -265,6 +265,20 @@ describe('given some notifications', () => {
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
describe('but notification was already marked as read', () => {
|
||||
beforeEach(async () => {
|
||||
variables = {
|
||||
...variables,
|
||||
id: 'p2',
|
||||
}
|
||||
})
|
||||
it('returns null', async () => {
|
||||
const response = await mutate({ mutation: markAsReadMutation, variables })
|
||||
expect(response.data.markAsRead).toEqual(null)
|
||||
expect(response.errors).toBeUndefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('on a comment', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user