feat: add moderation tools (#33)

* feat: Add post submission removal

* feat: add comment submission removal

* feat: add report viewing and resolving

* misc: add notification dot

* misc: add locked thread badge

* feat: add thread locking

* feat: add initiating message conversations

* feat: add post pinning/unpinning

* misc: bump version

* fix: tweak lock colors

* fix: update post data on pin

* fix: return if reason is empty
This commit is contained in:
Xylight authored and GitHub committed 2023-07-27 15:53:31 -07:00
1 parent 53ef843cde
commit d3aae647a8
29 files changed
+835 -67

No files matched your search

@@ -22,7 +22,9 @@
import Button from '$lib/components/input/Button.svelte'
import { createEventDispatcher } from 'svelte'
import { isCommentMutable } from '$lib/components/lemmy/post/helpers.js'
import { report } from '$lib/components/lemmy/moderation/moderation.js'
import { isMod, report } from '$lib/components/lemmy/moderation/moderation.js'
import ModerationMenu from '$lib/components/lemmy/moderation/ModerationMenu.svelte'
import CommentModerationMenu from '$lib/components/lemmy/moderation/CommentModerationMenu.svelte'
export let comment: CommentView
export let replying: boolean = false
@@ -59,10 +61,18 @@
bind:vote={comment.my_vote}
commentId={comment.comment.id}
/>
<Button color="elevatedLow" size="sm" on:click={() => (replying = !replying)}>
<Button
color="elevatedLow"
size="sm"
on:click={() => (replying = !replying)}
disabled={comment.post.locked}
>
<Icon src={ArrowUturnLeft} width={14} height={14} mini />
<span class="text-xs">Reply</span>
</Button>
{#if $user && isMod($user, comment.community.id)}
<CommentModerationMenu item={comment} />
{/if}
<Menu
let:toggleOpen
class="h-[26px] top-0 leading-3"
@@ -91,7 +101,7 @@
</MenuButton>
{#if $user && $authData && isCommentMutable(comment, $user.local_user_view)}
<MenuButton
color={Color.dangerSecondary}
color="dangerSecondary"
on:click={async () => {
if (!$authData) return
try {
@@ -117,10 +127,7 @@
</MenuButton>
{/if}
{#if $authData && $user?.local_user_view.person.id != comment.creator.id}
<MenuButton
on:click={() => report(comment)}
color={Color.dangerSecondary}
>
<MenuButton on:click={() => report(comment)} color="dangerSecondary">
<Icon src={Flag} mini size="16" />
<span>Report</span>
</MenuButton>
@@ -9,6 +9,7 @@
export let postId: number
export let parentId: number | undefined = undefined
export let locked: boolean = false
const dispatch = createEventDispatcher<{ comment: CommentResponse }>()
@@ -51,9 +52,10 @@
<div class="flex flex-col gap-2 relative">
<TextArea
rows={4}
placeholder="What are you thinking?"
placeholder={locked ? 'This post is locked.' : 'What are you thinking?'}
class="!bg-slate-100 dark:!bg-zinc-900"
bind:value={newComment}
disabled={locked}
/>
<div class="sm:ml-auto sm:w-28">
<Button
@@ -63,6 +65,7 @@
size="lg"
class="w-full"
{loading}
disabled={locked || loading}
>
Submit
</Button>