From 74fd7714ce691b7ef22701467b0e4683e74c9e5e Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Fri, 28 Jul 2023 10:35:23 -0700 Subject: [PATCH] fix #34 --- .../lemmy/comment/CommentActions.svelte | 2 +- .../components/lemmy/moderation/moderation.ts | 16 ++++++++++++---- src/lib/components/lemmy/post/PostActions.svelte | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/components/lemmy/comment/CommentActions.svelte b/src/lib/components/lemmy/comment/CommentActions.svelte index 062f8ead..d602e639 100644 --- a/src/lib/components/lemmy/comment/CommentActions.svelte +++ b/src/lib/components/lemmy/comment/CommentActions.svelte @@ -70,7 +70,7 @@ Reply - {#if $user && isMod($user, comment.community.id)} + {#if $user && isMod($user, comment.community)} {/if} - me.moderates.map((c) => c.community.id).includes(community) +export const isMod = (me: MyUserInfo, community: Community) => + me.moderates.map((c) => c.community.id).includes(community.id) || + (community.local && isAdmin(me)) -export const isModOfAny = (me?: MyUserInfo) => me && me.moderates.length > 0 +export const isModOfAny = (me?: MyUserInfo) => + me && (me.moderates.length > 0 || isAdmin(me)) export const isAdmin = (me: MyUserInfo) => me.local_user_view.person.admin diff --git a/src/lib/components/lemmy/post/PostActions.svelte b/src/lib/components/lemmy/post/PostActions.svelte index b88657a9..6cbe5466 100644 --- a/src/lib/components/lemmy/post/PostActions.svelte +++ b/src/lib/components/lemmy/post/PostActions.svelte @@ -100,7 +100,7 @@
- {#if $user && isMod($user, post.community.id)} + {#if $user && isMod($user, post.community)} {/if}