diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 76fbb4875..225ffa834 100644 --- a/backend/src/seed/seed-db.js +++ b/backend/src/seed/seed-db.js @@ -686,6 +686,34 @@ import { gql } from '../jest/helpers' }, }), ]) + // report content a second time + authenticatedUser = await dewey.toJson() + await Promise.all([ + mutate({ + mutation: reportMutation, + variables: { + resourceId: 'c1', + reasonCategory: 'other', + reasonDescription: 'This comment is bigoted', + }, + }), + mutate({ + mutation: reportMutation, + variables: { + resourceId: 'p1', + reasonCategory: 'discrimination_etc', + reasonDescription: 'This post is bigoted', + }, + }), + mutate({ + mutation: reportMutation, + variables: { + resourceId: 'u1', + reasonCategory: 'doxing', + reasonDescription: 'This user is harassing me with bigoted remarks', + }, + }), + ]) authenticatedUser = null await Promise.all( diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 53de815a6..9c7cde641 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -511,6 +511,7 @@ "message": "Bist du sicher, dass du den Kommentar von \"{name}\" melden möchtest?", "error": "Du hast den Kommentar bereits gemeldet!" }, + "author": "Verfasser", "reason": { "category": { "label": "Wähle eine Kategorie:", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 0e9f123d1..9a5b0e634 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -512,6 +512,7 @@ "message": "Do you really want to report the comment from \"{name}\"?", "error": "You have already reported the comment!" }, + "author": "Author", "reason": { "category": { "label": "Select a category:", diff --git a/webapp/pages/moderation/index.vue b/webapp/pages/moderation/index.vue index 3149e2e98..835397d36 100644 --- a/webapp/pages/moderation/index.vue +++ b/webapp/pages/moderation/index.vue @@ -1,6 +1,88 @@ {{ $t('moderation.reports.name') }} + + + + + + + + + + + + + + {{ scope.row.post.title | truncate(100) }} + {{ scope.row.comment.contentExcerpt | removeHtml | truncate(100) }} + + + + + + + + + + + + + + + + + + + {{ scope.row.resource.disabledBy.name | truncate(50) }} + + — + + + @@ -158,9 +240,17 @@ export default { data() { return { reports: [], + reportedContentStructure: [], } }, computed: { + contentFields() { + return { + type: ' ', + reportedUserContent: ' ', + disabledBy: this.$t('moderation.reports.disabledBy'), + } + }, fields() { return { type: ' ', @@ -174,6 +264,40 @@ export default { } }, }, + watch: { + reports: { + immediate: true, + handler(newReports) { + const newReportedContentStructure = [] + newReports.forEach(report => { + const resource = + report.type === 'User' + ? report.user + : report.type === 'Post' + ? report.post + : report.type === 'Comment' + ? report.comment + : undefined + let idx = newReportedContentStructure.findIndex(content => content.resource.id === resource.id) + // if content not in content list, then push + if (idx === -1) { + idx = newReportedContentStructure.length + newReportedContentStructure.push({ + type: report.type, + resource, + user: report.user, + post: report.post, + comment: report.comment, + contentBelongsToUser: report.type === 'User' ? null : resource.author, + reports: [], + }) + } + newReportedContentStructure[idx].reports.push(report) + }) + this.reportedContentStructure = newReportedContentStructure + }, + }, + }, apollo: { reports: { query: reportListQuery(),