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

+16 -12
View File
@@ -12,6 +12,8 @@
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
export let post: PostView
export let actions: boolean = true
</script>
<Card class="bg-white flex flex-col w-full p-5 gap-2.5">
@@ -111,16 +113,18 @@
</p>
{/if}
{/if}
<PostActions
{post}
on:edit={(e) => {
post.post.name = e.detail.post.name
post.post.body = e.detail.post.body
post.post.url = e.detail.post.url
toast({
content: 'The post was edited successfully.',
type: ToastType.success,
})
}}
/>
{#if actions}
<PostActions
{post}
on:edit={(e) => {
post.post.name = e.detail.post.name
post.post.body = e.detail.post.body
post.post.url = e.detail.post.url
toast({
content: 'The post was edited successfully.',
type: ToastType.success,
})
}}
/>
{/if}
</Card>
@@ -9,6 +9,7 @@
BookmarkSlash,
ChatBubbleOvalLeft,
EllipsisHorizontal,
Flag,
Icon,
Newspaper,
PencilSquare,
@@ -27,6 +28,7 @@
import { createEventDispatcher } from 'svelte'
import Modal from '$lib/components/ui/modal/Modal.svelte'
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
import { report } from '$lib/components/lemmy/moderation/moderation.js'
export let post: PostView
@@ -142,12 +144,18 @@
<Icon src={post.saved ? BookmarkSlash : Bookmark} width={16} mini />
{post.saved ? 'Unsave' : 'Save'}
</MenuButton>
{/if}
{#if $user && isMutable(post, $user)}
<MenuButton on:click={deletePost} color={Color.dangerSecondary}>
<Icon src={Trash} width={16} mini />
Delete
</MenuButton>
{#if $user && isMutable(post, $user)}
<MenuButton on:click={deletePost} color={Color.dangerSecondary}>
<Icon src={Trash} width={16} mini />
Delete
</MenuButton>
{/if}
{#if $user?.person.id != post.creator.id}
<MenuButton on:click={() => report(post)} color={Color.dangerSecondary}>
<Icon src={Flag} width={16} mini />
Report
</MenuButton>
{/if}
{/if}
</Menu>
</div>