feat: Fix commenting issue
This commit is contained in:
1 parent
d9812b17bd
commit
dd30acf19d
5 files changed
+16
-6
No files matched your search
@@ -159,7 +159,14 @@
|
||||
{postId}
|
||||
parentId={node.comment_view.comment.id}
|
||||
on:comment={(e) => {
|
||||
node.children = [e.detail, ...node.children]
|
||||
node.children = [
|
||||
{
|
||||
children: [],
|
||||
depth: node.depth,
|
||||
comment_view: e.detail.comment_view,
|
||||
},
|
||||
...node.children,
|
||||
]
|
||||
replying = false
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import type { Comment, Post } from 'lemmy-js-client'
|
||||
import type { CommentResponse } from 'lemmy-js-client'
|
||||
import { authData, getClient, user } from '$lib/lemmy.js'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
|
||||
@@ -9,7 +9,7 @@
|
||||
export let postId: number
|
||||
export let parentId: number | undefined = undefined
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const dispatch = createEventDispatcher<{ comment: CommentResponse }>()
|
||||
|
||||
let newComment = ''
|
||||
let loading = false
|
||||
@@ -35,6 +35,7 @@
|
||||
ToastType.success
|
||||
)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
addToast(
|
||||
'Error',
|
||||
'Failed to comment. (Sometimes this error appears even when successful.)',
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<svelte:head>Login</svelte:head>
|
||||
|
||||
<Card class="mx-auto p-6">
|
||||
<Card class="mx-auto p-6 max-w-lg">
|
||||
<form on:submit|preventDefault={logIn} class="flex flex-col gap-4">
|
||||
<h1 class="font-bold text-lg">Log in</h1>
|
||||
<TextInput
|
||||
|
||||
@@ -157,7 +157,10 @@
|
||||
<CommentForm
|
||||
postId={post.id}
|
||||
on:comment={(comment) =>
|
||||
(comments.comments = [...comment.detail, comments.comments])}
|
||||
(comments.comments = [
|
||||
comment.detail.comment_view,
|
||||
...comments.comments,
|
||||
])}
|
||||
/>
|
||||
{/if}
|
||||
<MultiSelect
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
Icon,
|
||||
PencilSquare,
|
||||
} from 'svelte-hero-icons'
|
||||
import SvelteMarkdown from 'svelte-markdown'
|
||||
|
||||
export let data: {
|
||||
user: GetPersonDetailsResponse
|
||||
|
||||
Reference in new issue
Block a user