diff --git a/src/lib/components/lemmy/moderation/BanModal.svelte b/src/lib/components/lemmy/moderation/BanModal.svelte index d2d8027f..59e1fd77 100644 --- a/src/lib/components/lemmy/moderation/BanModal.svelte +++ b/src/lib/components/lemmy/moderation/BanModal.svelte @@ -32,7 +32,7 @@ $: if (item) resetReason() async function submit() { - if (!item || !$profile?.user || !community || !$profile?.jwt) return + if (!item || !$profile?.user || !$profile?.jwt) return loading = true @@ -63,15 +63,26 @@ } } - await getClient().banFromCommunity({ - auth: $profile.jwt, - ban: !banned, - community_id: community.id, - person_id: item.id, - reason: reason || undefined, - remove_data: deleteData, - expires: date ? Math.floor(date / 1000) : undefined, - }) + if (community) { + await getClient().banFromCommunity({ + auth: $profile.jwt, + ban: !banned, + community_id: community.id, + person_id: item.id, + reason: reason || undefined, + remove_data: deleteData, + expires: date ? Math.floor(date / 1000) : undefined, + }) + } else { + await getClient().banPerson({ + auth: $profile.jwt, + ban: !banned, + person_id: item.id, + reason: reason || undefined, + remove_data: deleteData, + expires: date ? Math.floor(date / 1000) : undefined, + }) + } open = false @@ -94,7 +105,7 @@ } - +

{banned ? 'Unbanning' : 'Banning'} user

{#if item}
@@ -102,6 +113,11 @@ {item.name} +

+ {banned ? 'Unbanning' : 'Banning'} from {community + ? community.name + : 'site'} +