diff --git a/backend/src/schema/resolvers/reports.js b/backend/src/schema/resolvers/reports.js index da8d794c5..2a121e62c 100644 --- a/backend/src/schema/resolvers/reports.js +++ b/backend/src/schema/resolvers/reports.js @@ -11,9 +11,14 @@ export default { ` MATCH (submitter:User {id: $submitterId}) MATCH (resource {id: $resourceId}) - WHERE resource:User OR resource:Post OR resource:Comment + WHERE resource:User OR resource:Group OR resource:Post OR resource:Comment MERGE (resource)<-[:BELONGS_TO]-(report:Report {closed: false}) - ON CREATE SET report.id = randomUUID(), report.createdAt = $createdAt, report.updatedAt = report.createdAt, report.rule = 'latestReviewUpdatedAtRules', report.disable = resource.disabled, report.closed = false + ON CREATE SET report.id = randomUUID(), + report.createdAt = $createdAt, + report.updatedAt = report.createdAt, + report.rule = 'latestReviewUpdatedAtRules', + report.disable = resource.disabled, + report.closed = false WITH submitter, resource, report CREATE (report)<-[filed:FILED {createdAt: $createdAt, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription}]-(submitter) @@ -86,16 +91,16 @@ export default { // !!! this Cypher query returns multiple reports on the same resource! i will create an issue for refactoring (bug fixing) ` MATCH (report:Report)-[:BELONGS_TO]->(resource) - WHERE (resource:User OR resource:Post OR resource:Comment) + WHERE resource:User OR resource:Group OR resource:Post OR resource:Comment ${filterClause} WITH report, resource, - [(submitter:User)-[filed:FILED]->(report) | filed {.*, submitter: properties(submitter)} ] as filed, - [(moderator:User)-[reviewed:REVIEWED]->(report) | reviewed {.*, moderator: properties(moderator)} ] as reviewed, - [(resource)<-[:WROTE]-(author:User) | author {.*} ] as optionalAuthors, - [(resource)-[:COMMENTS]->(post:Post) | post {.*} ] as optionalCommentedPosts, - resource {.*, __typename: labels(resource)[0] } as resourceWithType + [(submitter:User)-[filed:FILED]->(report) | filed {.*, submitter: properties(submitter)} ] as filed, + [(moderator:User)-[reviewed:REVIEWED]->(report) | reviewed {.*, moderator: properties(moderator)} ] as reviewed, + [(resource)<-[:WROTE]-(author:User) | author {.*} ] as optionalAuthors, + [(resource)-[:COMMENTS]->(post:Post) | post {.*} ] as optionalCommentedPosts, + resource {.*, __typename: labels(resource)[0] } as resourceWithType WITH report, optionalAuthors, optionalCommentedPosts, reviewed, filed, - resourceWithType {.*, post: optionalCommentedPosts[0], author: optionalAuthors[0] } as finalResource + resourceWithType {.*, post: optionalCommentedPosts[0], author: optionalAuthors[0] } as finalResource RETURN report {.*, resource: finalResource, filed: filed, reviewed: reviewed } ${orderByClause} ${offset} ${limit} diff --git a/backend/src/schema/types/type/Report.gql b/backend/src/schema/types/type/Report.gql index 9a4a48c4b..3a756b1e0 100644 --- a/backend/src/schema/types/type/Report.gql +++ b/backend/src/schema/types/type/Report.gql @@ -10,7 +10,7 @@ type Report { resource: ReportedResource! } -union ReportedResource = User | Post | Comment +union ReportedResource = User | Group | Post | Comment enum ReportRule { latestReviewUpdatedAtRules diff --git a/webapp/components/ContentMenu/GroupContentMenu.vue b/webapp/components/ContentMenu/GroupContentMenu.vue index 7a7737320..f859dbedf 100644 --- a/webapp/components/ContentMenu/GroupContentMenu.vue +++ b/webapp/components/ContentMenu/GroupContentMenu.vue @@ -62,16 +62,31 @@ export default { params: { id: this.group.id, slug: this.group.slug }, }) } - if (this.group.myRole === 'owner') { + if (this.isOwner) { routes.push({ label: this.$t('admin.settings.name'), path: `/group/edit/${this.group.id}`, icon: 'edit', }) } + if (!this.isOwner) { + routes.push({ + label: this.$t(`report.${this.resourceType}.title`), + callback: () => { + this.openModal('report') + }, + icon: 'flag', + }) + } return routes }, + isOwner() { + return this.group.myRole === 'owner' + }, + resourceType() { + return 'group' + }, }, methods: { openItem(route, toggleMenu) { @@ -82,6 +97,16 @@ export default { } toggleMenu() }, + openModal(dialog, modalDataName = null) { + this.$store.commit('modal/SET_OPEN', { + name: dialog, + data: { + type: this.resourceType, + resource: this.group, + modalData: modalDataName ? this.modalsData[modalDataName] : {}, + }, + }) + }, }, } diff --git a/webapp/components/features/ReportRow/ReportRow.vue b/webapp/components/features/ReportRow/ReportRow.vue index 72fd8d24e..44b998f6b 100644 --- a/webapp/components/features/ReportRow/ReportRow.vue +++ b/webapp/components/features/ReportRow/ReportRow.vue @@ -115,16 +115,48 @@ export default { return reviewed && reviewed.length }, iconName() { - if (this.isPost) return 'bookmark' - else if (this.isComment) return 'comments' - else if (this.isUser) return 'user' - else return null + let name + switch (this.report.resource.__typename) { + case 'User': + name = 'user' + break + case 'Group': + name = 'users' + break + case 'Post': + name = 'bookmark' + break + case 'Comment': + name = 'comments' + break + + default: + name = null + break + } + return name }, iconLabel() { - if (this.isPost) return this.$t('report.contribution.type') - else if (this.isComment) return this.$t('report.comment.type') - else if (this.isUser) return this.$t('report.user.type') - else return null + let label + switch (this.report.resource.__typename) { + case 'User': + label = this.$t('report.user.type') + break + case 'Group': + label = this.$t('report.group.type') + break + case 'Post': + label = this.$t('report.contribution.type') + break + case 'Comment': + label = this.$t('report.comment.type') + break + + default: + label = null + break + } + return label }, linkTarget() { const { id, slug } = this.isComment ? this.report.resource.post : this.report.resource @@ -135,9 +167,26 @@ export default { } }, linkText() { - return ( - this.report.resource.title || this.$filters.removeHtml(this.report.resource.contentExcerpt) - ) + let text + switch (this.report.resource.__typename) { + case 'User': + text = '' // user avatar is used + break + case 'Group': + text = this.report.resource.name + break + case 'Post': + text = this.report.resource.title + break + case 'Comment': + text = this.$filters.removeHtml(this.report.resource.contentExcerpt) + break + + default: + text = null + break + } + return text }, statusIconName() { return this.isDisabled ? 'eye-slash' : 'eye' diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 6375ca48f..9d208626b 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -288,13 +288,13 @@ "delete": { "cancel": "Abbrechen", "comment": { - "message": "Bist Du sicher, dass Du den Kommentar „{name}“ löschen möchtest?", + "message": "Bist Du sicher, dass Du den Kommentar „{name}“ löschen möchtest?", "success": "Kommentar erfolgreich gelöscht!", "title": "Lösche Kommentar", "type": "Kommentar" }, "contribution": { - "message": "Bist Du sicher, dass Du den Beitrag „{name}“ löschen möchtest?", + "message": "Bist Du sicher, dass Du den Beitrag „{name}“ löschen möchtest?", "success": "Beitrag erfolgreich gelöscht!", "title": "Lösche Beitrag", "type": "Beitrag" @@ -304,19 +304,19 @@ "disable": { "cancel": "Abbrechen", "comment": { - "message": "Bist Du sicher, dass Du den Kommentar „{name}“ deaktivieren möchtest?", + "message": "Bist Du sicher, dass Du den Kommentar „{name}“ deaktivieren möchtest?", "title": "Kommentar sperren", "type": "Kommentar" }, "contribution": { - "message": "Bist Du sicher, dass Du den Beitrag von „{name}“ deaktivieren möchtest?", + "message": "Bist Du sicher, dass Du den Beitrag von „{name}“ deaktivieren möchtest?", "title": "Beitrag sperren", "type": "Beitrag" }, "submit": "Deaktivieren", "success": "Erfolgreich deaktiviert", "user": { - "message": "Bist Du sicher, dass Du den Nutzer „{name}“ sperren möchtest?", + "message": "Bist Du sicher, dass Du den Nutzer „{name}“ sperren möchtest?", "title": "Nutzer sperren", "type": "Nutzer" } @@ -522,32 +522,32 @@ "cancel": "Abbruch", "Comment": { "disable": { - "message": "Möchtest Du den Kommentar „{name}“ wirklich gesperrt lassen?", + "message": "Möchtest Du den Kommentar „{name}“ wirklich gesperrt lassen?", "title": "Sperre den Kommentar abschließend" }, "enable": { - "message": "Möchtest Du den Kommentar „{name}“ wirklich entsperrt lassen?", + "message": "Möchtest Du den Kommentar „{name}“ wirklich entsperrt lassen?", "title": "Entsperre den Kommentar abschließend" } }, "Post": { "disable": { - "message": "Möchtest Du den Beitrag „{name}“ wirklich gesperrt lassen?", + "message": "Möchtest Du den Beitrag „{name}“ wirklich gesperrt lassen?", "title": "Sperre den Beitrag abschließend" }, "enable": { - "message": "Möchtest Du den Beitrag „{name}“ wirklich entsperrt lassen?", + "message": "Möchtest Du den Beitrag „{name}“ wirklich entsperrt lassen?", "title": "Entsperre den Beitrag abschließend" } }, "submit": "Bestätige Entscheidung", "User": { "disable": { - "message": "Möchtest Du den Benutzer „{name}“ wirklich gesperrt lassen?", + "message": "Möchtest Du den Benutzer „{name}“ wirklich gesperrt lassen?", "title": "Sperre den Benutzer abschließend" }, "enable": { - "message": "Möchtest Du den Benutzer „{name}“ wirklich entsperrt lassen?", + "message": "Möchtest Du den Benutzer „{name}“ wirklich entsperrt lassen?", "title": "Entsperre den Benutzer abschließend" } } @@ -656,13 +656,13 @@ "cancel": "Abbrechen", "comment": { "error": "Den Kommentar hast Du schon gemeldet!", - "message": "Bist Du sicher, dass Du den Kommentar „{name}“ freigeben möchtest?", + "message": "Bist Du sicher, dass Du den Kommentar „{name}“ freigeben möchtest?", "title": "Kommentar freigeben", "type": "Kommentar" }, "contribution": { "error": "Den Beitrag hast Du schon gemeldet!", - "message": "Bist Du sicher, dass Du den Beitrag „{name}“ freigeben möchtest?", + "message": "Bist Du sicher, dass Du den Beitrag „{name}“ freigeben möchtest?", "title": "Beitrag freigeben", "type": "Beitrag" }, @@ -670,7 +670,7 @@ "success": "Erfolgreich freigegeben!", "user": { "error": "Den Benutzer hast Du schon gemeldet!", - "message": "Bist Du sicher, dass Du den Nutzer „{name}“ freigeben möchtest?", + "message": "Bist Du sicher, dass Du den Nutzer „{name}“ freigeben möchtest?", "title": "Nutzer freigeben", "type": "Nutzer" } @@ -679,16 +679,22 @@ "cancel": "Abbrechen", "comment": { "error": "Du hast den Kommentar bereits gemeldet!", - "message": "Bist Du sicher, dass Du den Kommentar von „{name}“ melden möchtest?", + "message": "Bist Du sicher, dass Du den Kommentar von „{name}“ melden möchtest?", "title": "Kommentar melden", "type": "Kommentar" }, "contribution": { "error": "Du hast den Beitrag bereits gemeldet!", - "message": "Bist Du sicher, dass Du den Beitrag „{name}“ melden möchtest?", + "message": "Bist Du sicher, dass Du den Beitrag „{name}“ melden möchtest?", "title": "Beitrag melden", "type": "Beitrag" }, + "group": { + "error": "Du hast die Gruppe bereits gemeldet!", + "message": "Bist Du sicher, dass Du die Gruppe „{name}“ melden möchtest?", + "title": "Gruppe melden", + "type": "Gruppe" + }, "reason": { "category": { "invalid": "Bitte wähle ein gültiges Thema aus", @@ -714,7 +720,7 @@ "success": "Vielen Dank für diese Meldung!", "user": { "error": "Du hast den Benutzer bereits gemeldet!", - "message": "Bist Du sicher, dass Du den Nutzer „{name}“ melden möchtest?", + "message": "Bist Du sicher, dass Du den Nutzer „{name}“ melden möchtest?", "title": "Nutzer melden", "type": "Nutzer" } diff --git a/webapp/locales/en.json b/webapp/locales/en.json index aab9c6f83..32bb97aa5 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -288,13 +288,13 @@ "delete": { "cancel": "Cancel", "comment": { - "message": "Do you really want to delete the comment \"{name}\"?", + "message": "Do you really want to delete the comment “{name}”?", "success": "Comment successfully deleted!", "title": "Delete Comment", "type": "Comment" }, "contribution": { - "message": "Do you really want to delete the post \"{name}\"?", + "message": "Do you really want to delete the post “{name}”?", "success": "Post successfully deleted!", "title": "Delete Post", "type": "Contribution" @@ -304,19 +304,19 @@ "disable": { "cancel": "Cancel", "comment": { - "message": "Do you really want to disable the comment from \"{name}\"?", + "message": "Do you really want to disable the comment from “{name}”?", "title": "Disable Comment", "type": "Comment" }, "contribution": { - "message": "Do you really want to disable the contribution \"{name}\"?", + "message": "Do you really want to disable the contribution “{name}”?", "title": "Disable Contribution", "type": "Contribution" }, "submit": "Disable", "success": "Disabled successfully!", "user": { - "message": "Do you really want to disable the user \"{name}\"?", + "message": "Do you really want to disable the user “{name}”?", "title": "Disable User", "type": "User" } @@ -522,32 +522,32 @@ "cancel": "Cancel", "Comment": { "disable": { - "message": "Do you really want to let the comment \"{name}\" stay disabled?", + "message": "Do you really want to let the comment “{name}” stay disabled?", "title": "Finally Disable Comment" }, "enable": { - "message": "Do you really want to let the comment \"{name}\" stay enabled?", + "message": "Do you really want to let the comment “{name}” stay enabled?", "title": "Finally Enable Comment" } }, "Post": { "disable": { - "message": "Do you really want to let the post \"{name}\" stay disabled?", + "message": "Do you really want to let the post “{name}” stay disabled?", "title": "Finally Disable Post" }, "enable": { - "message": "Do you really want to let the post \"{name}\" stay enabled?", + "message": "Do you really want to let the post “{name}” stay enabled?", "title": "Finally Enable Post" } }, "submit": "Confirm decision", "User": { "disable": { - "message": "Do you really want to let the user \"{name}\" stay disabled?", + "message": "Do you really want to let the user “{name}” stay disabled?", "title": "Finally Disable User" }, "enable": { - "message": "Do you really want to let the user \"{name}\" stay enabled?", + "message": "Do you really want to let the user “{name}” stay enabled?", "title": "Finally Enable User" } } @@ -656,13 +656,13 @@ "cancel": "Cancel", "comment": { "error": "You have already reported the comment!", - "message": "Do you really want to release the comment from \"{name}\"?", + "message": "Do you really want to release the comment from “{name}”?", "title": "Release Comment", "type": "Comment" }, "contribution": { "error": "You have already reported the contribution!!", - "message": "Do you really want to release the contribution \"{name}\"?", + "message": "Do you really want to release the contribution “{name}”?", "title": "Release Contribution", "type": "Contribution" }, @@ -670,7 +670,7 @@ "success": "Released successfully!", "user": { "error": "You already reported the user!", - "message": "Do you really want to release the user \"{name}\"?", + "message": "Do you really want to release the user “{name}”?", "title": "Release User", "type": "User" } @@ -679,16 +679,22 @@ "cancel": "Cancel", "comment": { "error": "You have already reported the comment!", - "message": "Do you really want to report the comment from \"{name}\"?", + "message": "Do you really want to report the comment from “{name}”?", "title": "Report Comment", "type": "Comment" }, "contribution": { "error": "You have already reported the contribution!", - "message": "Do you really want to report the contribution \"{name}\"?", + "message": "Do you really want to report the contribution “{name}”?", "title": "Report Post", "type": "Contribution" }, + "group": { + "error": "You have already reported the group!", + "message": "Do you really want to report the group “{name}”?", + "title": "Report Group", + "type": "Group" + }, "reason": { "category": { "invalid": "Please select a valid topic", @@ -697,7 +703,7 @@ "advert_products_services_commercial": "Advertising products and services with commercial intent.", "criminal_behavior_violation_german_law": "Criminal behavior or violation of German law.", "discrimination_etc": "Discriminatory posts, comments, utterances or insults.", - "doxing": "The disclosure of others' personal information without their consent or threat there of (\"doxing\").", + "doxing": "The disclosure of others' personal information without their consent or threat there of (“doxing”).", "glorific_trivia_of_cruel_inhuman_acts": "Glorification or trivialization of cruel or inhuman acts of violence.", "intentional_intimidation_stalking_persecution": "Intentional intimidation, stalking or persecution.", "other": "Other …", @@ -714,7 +720,7 @@ "success": "Thanks for reporting!", "user": { "error": "You already reported the user!", - "message": "Do you really want to report the user \"{name}\"?", + "message": "Do you really want to report the user “{name}”?", "title": "Report User", "type": "User" } @@ -728,7 +734,7 @@ "User": "User ::: Users" }, "hint": "What are you searching for? Use !… for posts, @… for users, #… for hashtags.", - "no-results": "No results found for \"{search}\". Try a different search term!", + "no-results": "No results found for “{search}”. Try a different search term!", "page": "Page", "placeholder": "Search", "results": "result found ::: results found", @@ -881,7 +887,7 @@ }, "social-media": { "addNewTitle": "Add new link", - "editTitle": "Edit link \"{name}\"", + "editTitle": "Edit link “{name}”", "name": "Social media", "placeholder": "Your social media url", "requireUnique": "You added this url already", diff --git a/webapp/pages/group/_id/_slug.vue b/webapp/pages/group/_id/_slug.vue index ab342480c..4b1ec3079 100644 --- a/webapp/pages/group/_id/_slug.vue +++ b/webapp/pages/group/_id/_slug.vue @@ -18,7 +18,6 @@