feat: add reporting

This commit is contained in:
Xyphyn committed 2023-07-26 19:13:26 -07:00
1 parent ff2d424a99
commit 6fcef02809
14 files changed
+206 -33

No files matched your search

@@ -25,6 +25,7 @@
export let node: CommentNodeI
export let postId: number
export let op: boolean = false
export let actions: boolean = true
export let open = true
export let replying = false
@@ -71,7 +72,7 @@
{/if}
<li
class="py-2 {node.depth == 0
class="py-2 pb-3 {node.depth == 0
? 'border-b border-slate-200 dark:border-zinc-800'
: ''}"
id="#{node.comment_view.comment.id.toString()}"
@@ -140,13 +141,15 @@
<div class="max-w-full mt-0.5 break-words text-sm leading-[22px]">
<Markdown source={node.comment_view.comment.content} />
</div>
<div class="flex flex-row gap-2 items-center h-[26px]">
<CommentActions
comment={node.comment_view}
bind:replying
on:edit={() => (editing = true)}
/>
</div>
{#if actions}
<div class="flex flex-row gap-2 items-center h-[26px]">
<CommentActions
comment={node.comment_view}
bind:replying
on:edit={() => (editing = true)}
/>
</div>
{/if}
</div>
{#if replying}
<div class="max-w-sm my-2">
@@ -10,6 +10,7 @@
BookmarkSlash,
ChatBubbleOvalLeft,
EllipsisHorizontal,
Flag,
Icon,
PencilSquare,
Trash,
@@ -21,6 +22,7 @@
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'
export let comment: CommentView
export let replying: boolean = false
@@ -114,6 +116,15 @@
<span>Delete</span>
</MenuButton>
{/if}
{#if $authData && $user?.person.id != comment.creator.id}
<MenuButton
on:click={() => report(comment)}
color={Color.dangerSecondary}
>
<Icon src={Flag} mini size="16" />
<span>Report</span>
</MenuButton>
{/if}
{/if}
</Menu>
</div>