Delete post.image

In contrast to the other errors, it's better to send `null` for an
image. That way, the browser won't even try to load that url.
This commit is contained in:
roschaefer 2019-09-03 21:35:06 +02:00
parent 99dd6ea20a
commit 2a544376a3
4 changed files with 5 additions and 5 deletions

View File

@ -19,10 +19,10 @@ const obfuscate = async (resolve, root, args, context, info) => {
root.contentExcerpt = 'UNAVAILABLE'
root.title = 'UNAVAILABLE'
root.slug = 'UNAVAILABLE'
root.image = 'UNAVAILABLE'
root.avatar = 'UNAVAILABLE'
root.about = 'UNAVAILABLE'
root.name = 'UNAVAILABLE'
root.image = null // avoid unecessary 500 errors
}
return resolve(root, args, context, info)
}

View File

@ -240,7 +240,7 @@ describe('softDeleteMiddleware', () => {
it('obfuscates slug', () => expect(subject.slug).toEqual('UNAVAILABLE'))
it('obfuscates content', () => expect(subject.content).toEqual('UNAVAILABLE'))
it('obfuscates contentExcerpt', () => expect(subject.contentExcerpt).toEqual('UNAVAILABLE'))
it('obfuscates image', () => expect(subject.image).toEqual('UNAVAILABLE'))
it('obfuscates image', () => expect(subject.image).toEqual(null))
})
describe('Comment', () => {

View File

@ -149,11 +149,11 @@ export default {
MATCH (post:Post {id: $postId})
OPTIONAL MATCH (post)<-[:COMMENTS]-(comment:Comment)
SET post.deleted = TRUE
SET post.image = 'UNAVAILABLE'
SET post.content = 'UNAVAILABLE'
SET post.contentExcerpt = 'UNAVAILABLE'
SET post.title = 'UNAVAILABLE'
SET comment.deleted = TRUE
REMOVE post.image
RETURN post
`,
{ postId: args.id },

View File

@ -470,7 +470,7 @@ describe('DeletePost', () => {
deleted: true,
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
image: 'UNAVAILABLE',
image: null,
comments: [],
},
},
@ -497,7 +497,7 @@ describe('DeletePost', () => {
deleted: true,
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
image: 'UNAVAILABLE',
image: null,
comments: [
{
deleted: true,