fix #34
This commit is contained in:
1 parent
0d98986871
commit
74fd7714ce
3 files changed
+14
-6
No files matched your search
@@ -70,7 +70,7 @@
|
|||||||
<Icon src={ArrowUturnLeft} width={14} height={14} mini />
|
<Icon src={ArrowUturnLeft} width={14} height={14} mini />
|
||||||
<span class="text-xs">Reply</span>
|
<span class="text-xs">Reply</span>
|
||||||
</Button>
|
</Button>
|
||||||
{#if $user && isMod($user, comment.community.id)}
|
{#if $user && isMod($user, comment.community)}
|
||||||
<CommentModerationMenu item={comment} />
|
<CommentModerationMenu item={comment} />
|
||||||
{/if}
|
{/if}
|
||||||
<Menu
|
<Menu
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import type { CommentView, MyUserInfo, PostView } from 'lemmy-js-client'
|
import type {
|
||||||
|
CommentView,
|
||||||
|
Community,
|
||||||
|
CommunityView,
|
||||||
|
MyUserInfo,
|
||||||
|
PostView,
|
||||||
|
} from 'lemmy-js-client'
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
interface Modals {
|
interface Modals {
|
||||||
@@ -43,9 +49,11 @@ export function remove(item: PostView | CommentView) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isMod = (me: MyUserInfo, community: number) =>
|
export const isMod = (me: MyUserInfo, community: Community) =>
|
||||||
me.moderates.map((c) => c.community.id).includes(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
|
export const isAdmin = (me: MyUserInfo) => me.local_user_view.person.admin
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
<FormattedNumber number={post.counts.comments} />
|
<FormattedNumber number={post.counts.comments} />
|
||||||
</Button>
|
</Button>
|
||||||
<div class="ml-auto" />
|
<div class="ml-auto" />
|
||||||
{#if $user && isMod($user, post.community.id)}
|
{#if $user && isMod($user, post.community)}
|
||||||
<ModerationMenu item={post} community={post.community} />
|
<ModerationMenu item={post} community={post.community} />
|
||||||
{/if}
|
{/if}
|
||||||
<Menu alignment="bottom-right" class="overflow-auto" let:toggleOpen>
|
<Menu alignment="bottom-right" class="overflow-auto" let:toggleOpen>
|
||||||
|
|||||||
Reference in new issue
Block a user