From ddaf3c98ee38bd53056bc681fb8bd2ccc698ed5c Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Mon, 3 May 2021 19:40:59 +0300 Subject: [PATCH] Fix hide_case being required --- backend/src/plugins/Automod/actions/ban.ts | 4 ++-- backend/src/plugins/Automod/actions/kick.ts | 4 ++-- backend/src/plugins/Automod/actions/mute.ts | 4 ++-- backend/src/plugins/Automod/actions/warn.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/src/plugins/Automod/actions/ban.ts b/backend/src/plugins/Automod/actions/ban.ts index 5619cca8..4867ead7 100644 --- a/backend/src/plugins/Automod/actions/ban.ts +++ b/backend/src/plugins/Automod/actions/ban.ts @@ -22,7 +22,7 @@ export const BanAction = automodAction({ notifyChannel: tNullable(t.string), deleteMessageDays: tNullable(t.number), postInCaseLog: tNullable(t.boolean), - hide_case: t.boolean, + hide_case: tNullable(t.boolean), }), defaultConfig: { @@ -41,7 +41,7 @@ export const BanAction = automodAction({ extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, - hide: actionConfig.hide_case, + hide: Boolean(actionConfig.hide_case), }; const userIdsToBan = unique(contexts.map(c => c.user?.id).filter(nonNullish)); diff --git a/backend/src/plugins/Automod/actions/kick.ts b/backend/src/plugins/Automod/actions/kick.ts index 38c6cde1..879a541d 100644 --- a/backend/src/plugins/Automod/actions/kick.ts +++ b/backend/src/plugins/Automod/actions/kick.ts @@ -12,7 +12,7 @@ export const KickAction = automodAction({ notify: tNullable(t.string), notifyChannel: tNullable(t.string), postInCaseLog: tNullable(t.boolean), - hide_case: t.boolean, + hide_case: tNullable(t.boolean), }), defaultConfig: { @@ -29,7 +29,7 @@ export const KickAction = automodAction({ extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, - hide: actionConfig.hide_case, + hide: Boolean(actionConfig.hide_case), }; const userIdsToKick = unique(contexts.map(c => c.user?.id).filter(nonNullish)); diff --git a/backend/src/plugins/Automod/actions/mute.ts b/backend/src/plugins/Automod/actions/mute.ts index d5ae8363..798b8b10 100644 --- a/backend/src/plugins/Automod/actions/mute.ts +++ b/backend/src/plugins/Automod/actions/mute.ts @@ -26,7 +26,7 @@ export const MuteAction = automodAction({ remove_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])), restore_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])), postInCaseLog: tNullable(t.boolean), - hide_case: t.boolean, + hide_case: tNullable(t.boolean), }), defaultConfig: { @@ -46,7 +46,7 @@ export const MuteAction = automodAction({ extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, - hide: actionConfig.hide_case, + hide: Boolean(actionConfig.hide_case), }; const userIdsToMute = unique(contexts.map(c => c.user?.id).filter(nonNullish)); diff --git a/backend/src/plugins/Automod/actions/warn.ts b/backend/src/plugins/Automod/actions/warn.ts index 2aa381fe..feccf2b0 100644 --- a/backend/src/plugins/Automod/actions/warn.ts +++ b/backend/src/plugins/Automod/actions/warn.ts @@ -12,7 +12,7 @@ export const WarnAction = automodAction({ notify: tNullable(t.string), notifyChannel: tNullable(t.string), postInCaseLog: tNullable(t.boolean), - hide_case: t.boolean, + hide_case: tNullable(t.boolean), }), defaultConfig: { @@ -29,7 +29,7 @@ export const WarnAction = automodAction({ extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, - hide: actionConfig.hide_case, + hide: Boolean(actionConfig.hide_case), }; const userIdsToWarn = unique(contexts.map(c => c.user?.id).filter(nonNullish));