diff --git a/package.json b/package.json
index ebca3772..2195b304 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "photon-lemmy",
- "version": "0.5.8",
+ "version": "0.5.9",
"private": true,
"scripts": {
"dev": "vite dev",
diff --git a/src/lib/components/lemmy/moderation/RemoveModal.svelte b/src/lib/components/lemmy/moderation/RemoveModal.svelte
index 71a42a9a..8aea1ed0 100644
--- a/src/lib/components/lemmy/moderation/RemoveModal.svelte
+++ b/src/lib/components/lemmy/moderation/RemoveModal.svelte
@@ -9,11 +9,14 @@
import { isComment, isPost } from '$lib/lemmy/item.js'
import type { CommentView, PostView } from 'lemmy-js-client'
import { profile } from '$lib/auth.js'
+ import Checkbox from '$lib/components/input/Checkbox.svelte'
+ import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
export let open: boolean
export let item: PostView | CommentView | undefined = undefined
let reason = ''
+ let commentReason: boolean = false
let loading = false
$: removed = item
@@ -22,6 +25,8 @@
: item.post.removed
: false
+ $: replyReason = `Your submission was removed for:\n${reason}`
+
async function remove() {
if (!item) return
if (!$profile?.jwt) throw new Error('Unauthenticated')
@@ -29,6 +34,29 @@
loading = true
try {
+ if (commentReason) {
+ if (replyReason == '') {
+ toast({
+ content: 'Your reply cannot be empty if "Reply reason" is enabled.',
+ })
+ return
+ }
+
+ await getClient()
+ .createComment({
+ auth: $profile.jwt,
+ content: replyReason,
+ post_id: item.post.id,
+ parent_id: isComment(item) ? item.comment.id : undefined,
+ })
+ .catch(() => {
+ toast({
+ content: 'Failed to post reply. Removing anyway...',
+ type: 'warning',
+ })
+ })
+ }
+
if (isComment(item)) {
await getClient().removeComment({
auth: $profile.jwt,
@@ -66,7 +94,11 @@
loading = false
}
- const resetText = () => (reason = '')
+ const resetText = () => {
+ reason = ''
+ replyReason = ''
+ commentReason = false
+ }
$: {
if (item) {
@@ -103,6 +135,19 @@
bind:value={reason}
/>
+ {#if !removed}
+ Reply with reason
+
+ {#if commentReason}
+
+ {/if}
+ {/if}
+