Improve reports

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-10-25 19:01:43 +02:00
parent cce0406db5
commit 389fa843e3
7 changed files with 487 additions and 432 deletions

View File

@@ -915,36 +915,42 @@ const toggleFollowNotify = () => {
});
};
const reportGroup = async (content: string, forward: boolean) => {
isReportModalActive.value = false;
reportModalRef.value.close();
const {
mutate: createReportMutation,
onError: onCreateReportError,
onDone: onCreateReportDone,
} = useCreateReport();
const {
mutate: createReportMutation,
onError: onCreateReportError,
onDone: oneCreateReportDone,
} = useCreateReport();
const reportGroup = (content: string, forward: boolean) => {
isReportModalActive.value = false;
console.debug("report group", {
reportedId: group.value?.id ?? "",
content,
forward,
});
createReportMutation({
reportedId: group.value?.id ?? "",
content,
forward,
});
oneCreateReportDone(() => {
notifier?.success(t("Group {groupTitle} reported", { groupTitle }));
});
onCreateReportError((error: any) => {
console.error(error);
notifier?.error(
t("Error while reporting group {groupTitle}", {
groupTitle,
})
);
});
};
onCreateReportDone(() => {
notifier?.success(
t("Group {groupTitle} reported", { groupTitle: groupTitle.value })
);
});
onCreateReportError((error: any) => {
console.error(error);
notifier?.error(
t("Error while reporting group {groupTitle}", {
groupTitle: groupTitle.value,
})
);
});
const triggerShare = (): void => {
if (navigator.share) {
navigator
@@ -1032,8 +1038,8 @@ const physicalAddress = computed((): Address | null => {
return new Address(group.value?.physicalAddress);
});
const ableToReport = computed((): boolean | undefined => {
return anonymousReportsConfig.value?.allowed;
const ableToReport = computed((): boolean => {
return anonymousReportsConfig.value?.allowed === true;
});
const organizedEvents = computed((): Paginate<IEvent> => {