feat: add admin and moderator badges to posts and comments

This commit is contained in:
Xylight committed 2024-03-09 12:00:34 -08:00
1 parent 3f5c49d4c4
commit 3c74cfe4e6
7 files changed
+85 -36

No files matched your search

@@ -19,6 +19,7 @@
import { profile } from '$lib/auth.js'
import { Button, Modal } from 'mono-svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import ShieldIcon from '../moderation/ShieldIcon.svelte'
export let node: CommentNodeI
export let postId: number
@@ -104,7 +105,16 @@
avatarSize={22}
avatar
user={node.comment_view.creator}
/>
>
<svelte:fragment slot="badges">
{#if node.comment_view.creator_is_moderator}
<ShieldIcon filled width={14} class="text-green-500" />
{/if}
{#if node.comment_view.creator_is_admin}
<ShieldIcon filled width={14} class="text-red-500" />
{/if}
</svelte:fragment>
</UserLink>
{#if op}
<span class="text-sky-500">OP</span>
{/if}
@@ -21,11 +21,18 @@
>
<div class="flex flex-row justify-between items-center">
<PostMeta
deleted={false}
featured={false}
nsfw={comment.post.nsfw}
badges={{
nsfw: comment.post.nsfw,
removed: comment.post.removed,
admin: false,
moderator: false,
saved: false,
deleted: comment.post.deleted,
featured:
comment.post.featured_community || comment.post.featured_local,
locked: comment.post.locked,
}}
published={publishedToDate(comment.comment.published)}
saved={false}
community={community ? comment.community : undefined}
/>
<Button