From 6365d3df54b3f8bb26274615b83933e52c01dc60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 14 Oct 2019 15:53:36 +0200 Subject: [PATCH] Implement enum for report reason categories after Matts suggestion --- backend/src/schema/resolvers/reports.js | 5 ++--- backend/src/schema/types/type/REPORTED.gql | 14 +++++++++++++- shared/moderation/report.js | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/src/schema/resolvers/reports.js b/backend/src/schema/resolvers/reports.js index dd9375995..3e63f1c1a 100644 --- a/backend/src/schema/resolvers/reports.js +++ b/backend/src/schema/resolvers/reports.js @@ -1,6 +1,6 @@ export default { Mutation: { - report: async (_parent, params, { driver, _req, user }, _resolveInfo) => { + report: async (_parent, params, { driver, user }, _resolveInfo) => { const { resourceId, reasonCategory, reasonDescription } = params const session = driver.session() @@ -85,7 +85,7 @@ export default { }, }, Query: { - reports: async (_parent, _params, { driver, _req, _user }, _resolveInfo) => { + reports: async (_parent, _params, { driver }, _resolveInfo) => { const session = driver.session() const res = await session.run( ` @@ -113,7 +113,6 @@ export default { const responseEle = { ...report.properties, - resource: resource.properties, resourceId: resource.properties.id, post: null, comment: null, diff --git a/backend/src/schema/types/type/REPORTED.gql b/backend/src/schema/types/type/REPORTED.gql index 276c5913b..b94dab882 100644 --- a/backend/src/schema/types/type/REPORTED.gql +++ b/backend/src/schema/types/type/REPORTED.gql @@ -1,6 +1,6 @@ type REPORTED { createdAt: String - reasonCategory: String + reasonCategory: ReasonCategory reasonDescription: String submitter: User @cypher(statement: "MATCH (resource)<-[:REPORTED]-(user:User) RETURN user") @@ -16,6 +16,18 @@ type REPORTED { comment: Comment } +# list see "reportReasonCategoriesDatabaseList" in shared file "shared/moderation/report.js" +enum ReasonCategory { + other + discrimination-etc + pornographic-content-links + glorific-trivia-of-cruel-inhuman-acts + doxing + intentional-intimidation-stalking-persecution + advert-products-services-commercial + criminal-behavior-violation-german-law +} + # not yet supported # union ReportReource = User | Post | Comment diff --git a/shared/moderation/report.js b/shared/moderation/report.js index a90837f67..75f6a076d 100644 --- a/shared/moderation/report.js +++ b/shared/moderation/report.js @@ -1,4 +1,5 @@ export const reportReasonCategoriesDatabaseList = () => { + // list see "ReasonCategory" in backend GraphQL schema file "REPORTED.gql" return [ 'other', // element # zero, because it is the nutral one 'discrimination-etc',