diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c162f3f..3431a8e8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ Also make sure to remove the `EnvironmentFile=` line from the systemd service an
- Duplicate an event
- Ability to handle basic administration settings in the admin panel
- Added physical address change to the list of important changes that trigger event notifications
+- Config option to allow anonymous reporting
### Changed
- Configuration handling (see above)
diff --git a/config/config.exs b/config/config.exs
index 5ee17d3f..012953b0 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -202,6 +202,9 @@ config :mobilizon, :anonymous,
],
captcha: [enabled: false]
}
+ ],
+ reports: [
+ allowed: false
]
config :mobilizon, Oban,
diff --git a/config/dev.exs b/config/dev.exs
index bfddae9c..a58b0c96 100644
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -92,6 +92,11 @@ config :mobilizon, :instance,
# config :mobilizon, :activitypub, sign_object_fetches: false
+config :mobilizon, :anonymous,
+ reports: [
+ allowed: true
+ ]
+
require Logger
cond do
diff --git a/js/src/graphql/comment.ts b/js/src/graphql/comment.ts
index 329b6605..8447c2f1 100644
--- a/js/src/graphql/comment.ts
+++ b/js/src/graphql/comment.ts
@@ -62,7 +62,7 @@ export const COMMENTS_THREADS = gql`
}
}
}
- ${COMMENT_RECURSIVE_FRAGMENT}
+ ${COMMENT_FIELDS_FRAGMENT}
`;
export const CREATE_COMMENT_FROM_EVENT = gql`
diff --git a/js/src/graphql/config.ts b/js/src/graphql/config.ts
index f7d07cbf..d3a29b43 100644
--- a/js/src/graphql/config.ts
+++ b/js/src/graphql/config.ts
@@ -34,6 +34,9 @@ export const CONFIG = gql`
}
}
}
+ reports {
+ allowed
+ }
actorId
}
location {
diff --git a/js/src/types/config.model.ts b/js/src/types/config.model.ts
index 07f83f5c..9c40936c 100644
--- a/js/src/types/config.model.ts
+++ b/js/src/types/config.model.ts
@@ -39,6 +39,9 @@ export interface IConfig {
};
};
};
+ reports: {
+ allowed: boolean;
+ };
actorId: string;
};
maps: {
diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue
index fcd64296..348ead9c 100644
--- a/js/src/views/Event/Event.vue
+++ b/js/src/views/Event/Event.vue
@@ -272,7 +272,7 @@
-
+
{{ $t("Report") }}
@@ -750,14 +750,25 @@ export default class Event extends EventMixin {
async reportEvent(content: string, forward: boolean) {
this.isReportModalActive = false;
+ // @ts-ignore
+ this.$refs.reportModal.close();
if (!this.event.organizerActor) return;
const eventTitle = this.event.title;
+ let reporterId = null;
+ if (this.currentActor.id) {
+ reporterId = this.currentActor.id;
+ } else {
+ if (this.config.anonymous.reports.allowed) {
+ reporterId = this.config.anonymous.actorId;
+ }
+ }
+ if (!reporterId) return;
try {
await this.$apollo.mutate({
mutation: CREATE_REPORT,
variables: {
eventId: this.event.id,
- reporterId: this.currentActor.id,
+ reporterId,
reportedId: this.event.organizerActor.id,
content,
forward,
@@ -996,6 +1007,12 @@ export default class Event extends EventMixin {
await removeAnonymousParticipation(this.uuid);
this.anonymousParticipation = null;
}
+
+ get ableToReport(): boolean {
+ return (
+ this.config && (this.currentActor.id != undefined || this.config.anonymous.reports.allowed)
+ );
+ }
}