feat: add comment distinguish option
This commit is contained in:
1 parent
5ea1f2e0cf
commit
0a6310380f
3 files changed
+42
-7
No files matched your search
@@ -1,7 +1,13 @@
|
||||
<script lang="ts">
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import { amMod, ban, isAdmin, remove } from './moderation'
|
||||
import { Fire, Icon, ShieldExclamation, Trash } from 'svelte-hero-icons'
|
||||
import { amMod, ban, feature, isAdmin, remove } from './moderation'
|
||||
import {
|
||||
Fire,
|
||||
Icon,
|
||||
Megaphone,
|
||||
ShieldExclamation,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { isCommentView } from '$lib/lemmy/item.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
@@ -29,8 +35,8 @@
|
||||
{$t('moderation.label')}
|
||||
{/if}
|
||||
</MenuDivider>
|
||||
<MenuButton color="success-subtle" on:click={() => remove(item)}>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item)}>
|
||||
<Icon src={Trash} size="16" mini slot="prefix" />
|
||||
{#if isCommentView(item)}
|
||||
{item.comment.removed
|
||||
? $t('moderation.restore')
|
||||
@@ -40,16 +46,37 @@
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{#if $profile?.user && $profile.user?.local_user_view.person.id != item.creator.id}
|
||||
<!--Comment made by someone else-->
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
ban(item.creator_banned_from_community, item.creator, item.community)}
|
||||
>
|
||||
<Icon src={ShieldExclamation} size="16" mini />
|
||||
<Icon src={ShieldExclamation} size="16" mini slot="prefix" />
|
||||
{item.creator_banned_from_community
|
||||
? $t('moderation.ban.unbanFromCommunity')
|
||||
: $t('moderation.ban.banFromCommunity')}
|
||||
</MenuButton>
|
||||
{:else if isCommentView(item)}
|
||||
<!--Comment made by self-->
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
on:click={async () => {
|
||||
if (!$profile.jwt) return
|
||||
item.comment = (
|
||||
await feature(
|
||||
!item.comment.distinguished,
|
||||
item.comment,
|
||||
$profile.jwt
|
||||
)
|
||||
).comment_view.comment
|
||||
}}
|
||||
>
|
||||
<Icon src={Megaphone} size="16" micro slot="prefix" />
|
||||
{item.comment.distinguished
|
||||
? $t('moderation.unfeature')
|
||||
: $t('moderation.feature')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in new issue
Block a user