Lint fix in backend

This commit is contained in:
Wolfgang Huß 2020-01-16 15:55:26 +01:00
parent d4e5de5eff
commit f2d4d97645
6 changed files with 80 additions and 59 deletions

View File

@ -140,9 +140,9 @@ const notifyReportFiler = async (resolve, root, args, context, resolveInfo) => {
},
)
})
} catch (error) {
debug(error)
} finally {
} catch (error) {
debug(error)
} finally {
session.close()
}
}

View File

@ -34,7 +34,7 @@ const createCommentMutation = gql`
}
}
`
const fileReportMutation = gql `
const fileReportMutation = gql`
mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
fileReport(
resourceId: $resourceId
@ -106,7 +106,7 @@ describe('notifications', () => {
reasonDescription
reportedResource {
__typename
...on User {
... on User {
id
name
}
@ -592,7 +592,7 @@ describe('notifications', () => {
})
authenticatedUser = await notifiedUser.toJson()
}
const setExpectedNotificationOfReportedResource = (reportedResource) => {
const setExpectedNotificationOfReportedResource = reportedResource => {
return expect.objectContaining({
data: {
notifications: [
@ -607,8 +607,8 @@ describe('notifications', () => {
{
reasonCategory: 'discrimination_etc',
reasonDescription: 'I am free to be gay !!!',
reportedResource
}
reportedResource,
},
],
},
},
@ -633,7 +633,7 @@ describe('notifications', () => {
await neode.create('User', reportedUserOrAuthorData)
resourceId = 'reportedUser'
await fileReportAction()
const expected = setExpectedNotificationOfReportedResource({
__typename: 'User',
id: 'reportedUser',
@ -663,7 +663,7 @@ describe('notifications', () => {
await createPostAction()
resourceId = 'p47'
await fileReportAction()
const expected = setExpectedNotificationOfReportedResource({
__typename: 'Post',
id: 'p47',
@ -697,7 +697,7 @@ describe('notifications', () => {
await createCommentOnPostAction()
resourceId = 'c47'
await fileReportAction()
const expected = setExpectedNotificationOfReportedResource({
__typename: 'Comment',
id: 'c47',

View File

@ -34,7 +34,12 @@ module.exports = {
read: { type: 'boolean', default: false },
reason: {
type: 'string',
valid: ['mentioned_in_post', 'mentioned_in_comment', 'commented_on_post', 'filed_report_on_resource'],
valid: [
'mentioned_in_post',
'mentioned_in_comment',
'commented_on_post',
'filed_report_on_resource',
],
},
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
},

View File

@ -59,7 +59,12 @@ module.exports = {
read: { type: 'boolean', default: false },
reason: {
type: 'string',
valid: ['mentioned_in_post', 'mentioned_in_comment', 'commented_on_post', 'filed_report_on_resource'],
valid: [
'mentioned_in_post',
'mentioned_in_comment',
'commented_on_post',
'filed_report_on_resource',
],
},
},
},

View File

@ -87,7 +87,7 @@ export default {
`,
{
resourceId: args.id,
id: currentUser.id
id: currentUser.id,
},
)
log(markNotificationAsReadTransactionResponse)

View File

@ -40,7 +40,7 @@ describe('given some notifications', () => {
const categoryIds = ['cat1']
author = await factory.create('User', { id: 'author' })
user = await factory.create('User', { id: 'you' })
const [neighbor,badWomen] = await Promise.all([
const [neighbor, badWomen] = await Promise.all([
factory.create('User', { id: 'neighbor' }),
factory.create('User', { id: 'badWomen', name: 'Mrs. Badwomen' }),
factory.create('Category', { id: 'cat1' }),
@ -199,16 +199,16 @@ describe('given some notifications', () => {
reasonDescription
reportedResource {
__typename
...on User {
... on User {
id
name
}
...on Post {
... on Post {
id
title
content
}
...on Comment {
... on Comment {
id
content
}
@ -275,15 +275,17 @@ describe('given some notifications', () => {
from: {
__typename: 'Report',
id: 'reportOnUser',
filed: [{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me with bigoted remarks!',
reportedResource: {
__typename: 'User',
id: 'badWomen',
name: 'Mrs. Badwomen',
filed: [
{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me with bigoted remarks!',
reportedResource: {
__typename: 'User',
id: 'badWomen',
name: 'Mrs. Badwomen',
},
},
}],
],
},
},
{
@ -293,16 +295,19 @@ describe('given some notifications', () => {
from: {
__typename: 'Report',
id: 'reportOnPost',
filed: [{
reasonCategory: 'other',
reasonDescription: "This shouldn't be shown to anybody else! It's my private thing!",
reportedResource: {
__typename: 'Post',
id: 'p4',
title: 'Bad Post',
content: 'I am bad content !!!',
filed: [
{
reasonCategory: 'other',
reasonDescription:
"This shouldn't be shown to anybody else! It's my private thing!",
reportedResource: {
__typename: 'Post',
id: 'p4',
title: 'Bad Post',
content: 'I am bad content !!!',
},
},
}],
],
},
},
{
@ -312,15 +317,17 @@ describe('given some notifications', () => {
from: {
__typename: 'Report',
id: 'reportOnComment',
filed: [{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me!',
reportedResource: {
__typename: 'Comment',
id: 'c4',
content: 'I am bad content in a bad comment to a bad post !!!',
filed: [
{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me!',
reportedResource: {
__typename: 'Comment',
id: 'c4',
content: 'I am bad content in a bad comment to a bad post !!!',
},
},
}],
],
},
},
]),
@ -364,15 +371,17 @@ describe('given some notifications', () => {
from: {
__typename: 'Report',
id: 'reportOnUser',
filed: [{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me with bigoted remarks!',
reportedResource: {
__typename: 'User',
id: 'badWomen',
name: 'Mrs. Badwomen',
filed: [
{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me with bigoted remarks!',
reportedResource: {
__typename: 'User',
id: 'badWomen',
name: 'Mrs. Badwomen',
},
},
}],
],
},
},
{
@ -382,15 +391,17 @@ describe('given some notifications', () => {
from: {
__typename: 'Report',
id: 'reportOnComment',
filed: [{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me!',
reportedResource: {
__typename: 'Comment',
id: 'c4',
content: 'I am bad content in a bad comment to a bad post !!!',
filed: [
{
reasonCategory: 'discrimination_etc',
reasonDescription: 'This user is harassing me!',
reportedResource: {
__typename: 'Comment',
id: 'c4',
content: 'I am bad content in a bad comment to a bad post !!!',
},
},
}],
],
},
},
]),