diff --git a/backend/src/middleware/softDelete/softDeleteMiddleware.spec.js b/backend/src/middleware/softDelete/softDeleteMiddleware.spec.js index 1baaa7487..7102b88cc 100644 --- a/backend/src/middleware/softDelete/softDeleteMiddleware.spec.js +++ b/backend/src/middleware/softDelete/softDeleteMiddleware.spec.js @@ -111,7 +111,7 @@ beforeAll(async () => { mutate = client.mutate authenticatedUser = await moderator.toJson() - const reportMutation = gql ` + const reportMutation = gql` mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) { report( resourceId: $resourceId diff --git a/backend/src/middleware/validation/validationMiddleware.js b/backend/src/middleware/validation/validationMiddleware.js index a50100d12..21890607b 100644 --- a/backend/src/middleware/validation/validationMiddleware.js +++ b/backend/src/middleware/validation/validationMiddleware.js @@ -112,9 +112,16 @@ const validateReview = async (resolve, root, args, context, info) => { }) if (!existingReportedResource) throw new Error(`Resource not found!`) - if (!existingReportedResource.report) throw new Error(`Before you can start the reviewing process, please report the ${existingReportedResource.label}!`) - const authorId = existingReportedResource.label !== 'User' && existingReportedResource.author ? existingReportedResource.author.id : null - if (authorId && resourceId === authorId) throw new Error(`You cannot review your own ${existingReportedResource.label}!`) + if (!existingReportedResource.report) + throw new Error( + `Before you can start the reviewing process, please report the ${existingReportedResource.label}!`, + ) + const authorId = + existingReportedResource.label !== 'User' && existingReportedResource.author + ? existingReportedResource.author.id + : null + if (authorId && resourceId === authorId) + throw new Error(`You cannot review your own ${existingReportedResource.label}!`) return resolve(root, args, context, info) } diff --git a/backend/src/schema/resolvers/moderation.js b/backend/src/schema/resolvers/moderation.js index b5416c686..1de06fa5f 100644 --- a/backend/src/schema/resolvers/moderation.js +++ b/backend/src/schema/resolvers/moderation.js @@ -81,7 +81,6 @@ export default { claimDisable: claim.properties.disable, claimClosed: claim.properties.closed, moderator: moderatorInResult.properties, - claimId: claim.id, type, post: null, comment: null, diff --git a/backend/src/schema/resolvers/moderation.spec.js b/backend/src/schema/resolvers/moderation.spec.js index 6e6fa856f..43e00d7fb 100644 --- a/backend/src/schema/resolvers/moderation.spec.js +++ b/backend/src/schema/resolvers/moderation.spec.js @@ -17,7 +17,7 @@ let query, moderator, nonModerator -const reportMutation = gql ` +const reportMutation = gql` mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) { report( resourceId: $resourceId diff --git a/backend/src/schema/resolvers/reports.js b/backend/src/schema/resolvers/reports.js index 34c0a9a0a..13bd89cfc 100644 --- a/backend/src/schema/resolvers/reports.js +++ b/backend/src/schema/resolvers/reports.js @@ -77,10 +77,10 @@ export default { let orderByClause switch (params.orderBy) { case 'createdAt_asc': - orderByClause = 'ORDER BY report.createdAt ASC' + orderByClause = 'ORDER BY claim.createdAt ASC, report.createdAt ASC' break case 'createdAt_desc': - orderByClause = 'ORDER BY report.createdAt DESC' + orderByClause = 'ORDER BY claim.createdAt DESC, report.createdAt DESC' break default: orderByClause = '' diff --git a/backend/src/schema/resolvers/user_management.spec.js b/backend/src/schema/resolvers/user_management.spec.js index f3976c183..61dfe49cf 100644 --- a/backend/src/schema/resolvers/user_management.spec.js +++ b/backend/src/schema/resolvers/user_management.spec.js @@ -18,7 +18,7 @@ const disable = async id => { const moderatorBearerToken = encode({ id: 'u2' }) req = { headers: { authorization: `Bearer ${moderatorBearerToken}` } } await mutate({ - mutation: gql ` + mutation: gql` mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) { report( resourceId: $resourceId diff --git a/webapp/locales/de.json b/webapp/locales/de.json index ae89820c8..ba0a4efad 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -493,6 +493,9 @@ "DecisionSuccess": "Erfolgreich entschieden!", "enabledBy": "Entsperrt von", "disabledBy": "Gesperrt von", + "previousDecision": "Vorherige Entscheidung:", + "enabledAt": "Entsperrt am", + "disabledAt": "Gesperrt am", "reasonCategory": "Kategorie", "reasonDescription": "Beschreibung", "createdAt": "Datum", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index c50aeb3bd..b082a5111 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -494,6 +494,9 @@ "DecisionSuccess": "Decided successfully!", "enabledBy": "Enabled by", "disabledBy": "Disabled by", + "previousDecision": "Previous decision:", + "enabledAt": "Enabled at", + "disabledAt": "Disabled at", "reasonCategory": "Category", "reasonDescription": "Description", "createdAt": "Date", diff --git a/webapp/pages/moderation/index.vue b/webapp/pages/moderation/index.vue index 0efd2ee56..fc82027fe 100644 --- a/webapp/pages/moderation/index.vue +++ b/webapp/pages/moderation/index.vue @@ -2,16 +2,16 @@ {{ $t('moderation.reports.name') }} -