From b379fff441b3d7fb98c688e502b2fae14010f21b Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Mon, 2 Oct 2023 16:20:19 -0700 Subject: [PATCH] feat: add community purging --- .../lemmy/community/CommunityCard.svelte | 110 +++++++++++++++--- src/lib/lemmy.ts | 2 +- src/lib/version.ts | 1 + 3 files changed, 96 insertions(+), 17 deletions(-) diff --git a/src/lib/components/lemmy/community/CommunityCard.svelte b/src/lib/components/lemmy/community/CommunityCard.svelte index 385c7e2a..fb42393c 100644 --- a/src/lib/components/lemmy/community/CommunityCard.svelte +++ b/src/lib/components/lemmy/community/CommunityCard.svelte @@ -1,13 +1,23 @@ +{#if purgingCommunity} + + Purging Community +

+ Purging community + {community_view.community.title} + +

+

+ Are you sure you want to do this? (The button will enable in 3 seconds.) +

+
+ + +
+
+{/if} +
@@ -165,17 +234,8 @@ ? 'Unsubscribe' : 'Subscribe'} - - {#if $profile.user && amMod($profile.user, community_view.community)} -
+
+ {#if $profile.user && amMod($profile.user, community_view.community)} -
- {/if} + {/if} + + + + + {community_view.blocked ? 'Unblock' : 'Block'} + + {#if $profile.user && isAdmin($profile.user)} + (purgingCommunity = !purgingCommunity)} + > + + Purge + + {/if} + +
{/if} diff --git a/src/lib/lemmy.ts b/src/lib/lemmy.ts index 16641e88..393b7f17 100644 --- a/src/lib/lemmy.ts +++ b/src/lib/lemmy.ts @@ -58,7 +58,7 @@ export function client({ init?: RequestInit | undefined ) => Promise auth?: string -}) { +} = {}) { if (!instanceURL) instanceURL = get(instance) let jwt = auth ? auth : get(profile)?.jwt diff --git a/src/lib/version.ts b/src/lib/version.ts index 3201a13a..933528fa 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -5,6 +5,7 @@ const FEATURES = { unproxiedImageUpload: '0.19.0', cursorPagination: '0.19.0', newTotp: '0.19.0', + blockInstances: '0.19.0', } type Feature = keyof typeof FEATURES