From c171dd494b100185080b25772fe53ba249f15a38 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 30 Sep 2020 15:25:30 +0200 Subject: [PATCH] Allow to report a group And multiple group tweaks Signed-off-by: Thomas Citharel --- js/src/components/Report/ReportCard.vue | 2 +- js/src/components/Report/ReportModal.vue | 12 +- js/src/graphql/report.ts | 2 +- js/src/i18n/en_US.json | 8 +- js/src/i18n/fr_FR.json | 8 +- js/src/views/Event/Event.vue | 23 +- js/src/views/Group/Group.vue | 99 ++++- js/src/views/Moderation/Report.vue | 130 ++++--- js/src/views/Moderation/ReportList.vue | 6 +- lib/mobilizon/actors/actor.ex | 2 +- lib/web/email/admin.ex | 3 +- lib/web/router.ex | 2 +- lib/web/templates/email/report.html.eex | 28 +- lib/web/templates/email/report.text.eex | 11 +- priv/gettext/ar/LC_MESSAGES/default.po | 58 ++- priv/gettext/be/LC_MESSAGES/default.po | 58 ++- priv/gettext/ca/LC_MESSAGES/default.po | 58 ++- priv/gettext/cs/LC_MESSAGES/default.po | 58 ++- priv/gettext/de/LC_MESSAGES/default.po | 60 ++- priv/gettext/default.pot | 58 ++- priv/gettext/en/LC_MESSAGES/default.po | 58 ++- priv/gettext/es/LC_MESSAGES/default.po | 62 ++- priv/gettext/fi/LC_MESSAGES/default.po | 60 ++- priv/gettext/fr/LC_MESSAGES/default.po | 444 +++++----------------- priv/gettext/it/LC_MESSAGES/default.po | 58 ++- priv/gettext/ja/LC_MESSAGES/default.po | 58 ++- priv/gettext/nl/LC_MESSAGES/default.po | 60 ++- priv/gettext/oc/LC_MESSAGES/default.po | 58 ++- priv/gettext/pl/LC_MESSAGES/default.po | 60 ++- priv/gettext/pt/LC_MESSAGES/default.po | 58 ++- priv/gettext/pt_BR/LC_MESSAGES/default.po | 58 ++- priv/gettext/ru/LC_MESSAGES/default.po | 62 ++- priv/gettext/sv/LC_MESSAGES/default.po | 60 ++- 33 files changed, 1088 insertions(+), 754 deletions(-) diff --git a/js/src/components/Report/ReportCard.vue b/js/src/components/Report/ReportCard.vue index fbc29daa3..1f305f30c 100644 --- a/js/src/components/Report/ReportCard.vue +++ b/js/src/components/Report/ReportCard.vue @@ -28,7 +28,7 @@ {{ $t("Reported by {reporter}", { reporter: report.reporter.preferredUsername }) }} -
{{ report.content }}
+
diff --git a/js/src/components/Report/ReportModal.vue b/js/src/components/Report/ReportModal.vue index 26fa34a69..020725eb7 100644 --- a/js/src/components/Report/ReportModal.vue +++ b/js/src/components/Report/ReportModal.vue @@ -100,15 +100,15 @@ export default class ReportModal extends Vue { forward = false; - get translatedCancelText() { - return this.cancelText || this.$t("Cancel"); + get translatedCancelText(): string { + return this.cancelText || (this.$t("Cancel") as string); } - get translatedConfirmText() { - return this.confirmText || this.$t("Send the report"); + get translatedConfirmText(): string { + return this.confirmText || (this.$t("Send the report") as string); } - confirm() { + confirm(): void { this.onConfirm(this.content, this.forward); this.close(); } @@ -116,7 +116,7 @@ export default class ReportModal extends Vue { /** * Close the Dialog. */ - close() { + close(): void { this.isActive = false; this.$emit("close"); } diff --git a/js/src/graphql/report.ts b/js/src/graphql/report.ts index 43784c855..e0cdac446 100644 --- a/js/src/graphql/report.ts +++ b/js/src/graphql/report.ts @@ -114,7 +114,7 @@ export const REPORT = gql` export const CREATE_REPORT = gql` mutation CreateReport( - $eventId: ID! + $eventId: ID $reporterId: ID! $reportedId: ID! $content: String diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index ff959e12e..a379b32ee 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -773,5 +773,11 @@ "Will allow to display and manage your participation status on the event page when using this device. Uncheck if you're using a public device.": "Will allow to display and manage your participation status on the event page when using this device. Uncheck if you're using a public device.", "Visit event page": "Visit event page", "Remember my participation in this browser": "Remember my participation in this browser", - "Organized by": "Organized by" + "Organized by": "Organized by", + "Report this group": "Report this group", + "Group {groupTitle} reported": "Group {groupTitle} reported", + "Error while reporting group {groupTitle}": "Error while reporting group {groupTitle}", + "Reported group": "Reported group", + "You can only get invited to groups right now.": "You can only get invited to groups right now.", + "Join group": "Join group" } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index 03ea86886..3cd54e786 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -810,5 +810,11 @@ "Will allow to display and manage your participation status on the event page when using this device. Uncheck if you're using a public device.": "Permet d'afficher et de gérer le statut de votre participation sur la page de l'événement lorsque vous utilisez cet appareil. Décochez si vous utilisez un appareil public.", "Visit event page": "Voir la page de l'événement", "Remember my participation in this browser": "Se souvenir de ma participation dans ce navigateur", - "Organized by": "Organisé par" + "Organized by": "Organisé par", + "Report this group": "Signaler ce groupe", + "Group {groupTitle} reported": "Groupe {groupTitle} signalé", + "Error while reporting group {groupTitle}": "Erreur lors du signalement du groupe {groupTitle}", + "Reported group": "Groupe signalé", + "You can only get invited to groups right now.": "Vous pouvez uniquement être invité aux groupes pour le moment.", + "Join group": "Rejoindre le groupe" } diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index 03a442144..84e6ae388 100644 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -413,7 +413,7 @@ @@ -521,7 +521,7 @@ import { ParticipantRole, EventJoinOptions, } from "../../types/event.model"; -import { IPerson, Person, usernameWithDomain } from "../../types/actor"; +import { IActor, IPerson, Person, usernameWithDomain } from "../../types/actor"; import { GRAPHQL_API_ENDPOINT } from "../../api/_entrypoint"; import DateCalendarIcon from "../../components/Event/DateCalendarIcon.vue"; import EventCard from "../../components/Event/EventCard.vue"; @@ -786,7 +786,7 @@ export default class Event extends EventMixin { variables: { eventId: this.event.id, reporterId, - reportedId: this.event.organizerActor.id, + reportedId: this.actorForReport ? this.actorForReport.id : null, content, forward, }, @@ -1026,6 +1026,23 @@ export default class Event extends EventMixin { this.config && (this.currentActor.id !== undefined || this.config.anonymous.reports.allowed) ); } + + get actorForReport(): IActor | null { + if (this.event.attributedTo && this.event.attributedTo.id) { + return this.event.attributedTo; + } + if (this.event.organizerActor) { + return this.event.organizerActor; + } + return null; + } + + get domainForReport(): string | null { + if (this.actorForReport) { + return this.actorForReport.domain; + } + return null; + } }