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}
|
{postId}
|
||||||
parentId={node.comment_view.comment.id}
|
parentId={node.comment_view.comment.id}
|
||||||
on:comment={(e) => {
|
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
|
replying = false
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from '$lib/components/input/Button.svelte'
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import { Color } from '$lib/ui/colors.js'
|
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 { authData, getClient, user } from '$lib/lemmy.js'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
|
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
export let postId: number
|
export let postId: number
|
||||||
export let parentId: number | undefined = undefined
|
export let parentId: number | undefined = undefined
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher<{ comment: CommentResponse }>()
|
||||||
|
|
||||||
let newComment = ''
|
let newComment = ''
|
||||||
let loading = false
|
let loading = false
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
ToastType.success
|
ToastType.success
|
||||||
)
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
addToast(
|
addToast(
|
||||||
'Error',
|
'Error',
|
||||||
'Failed to comment. (Sometimes this error appears even when successful.)',
|
'Failed to comment. (Sometimes this error appears even when successful.)',
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
<svelte:head>Login</svelte:head>
|
<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">
|
<form on:submit|preventDefault={logIn} class="flex flex-col gap-4">
|
||||||
<h1 class="font-bold text-lg">Log in</h1>
|
<h1 class="font-bold text-lg">Log in</h1>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
@@ -157,7 +157,10 @@
|
|||||||
<CommentForm
|
<CommentForm
|
||||||
postId={post.id}
|
postId={post.id}
|
||||||
on:comment={(comment) =>
|
on:comment={(comment) =>
|
||||||
(comments.comments = [...comment.detail, comments.comments])}
|
(comments.comments = [
|
||||||
|
comment.detail.comment_view,
|
||||||
|
...comments.comments,
|
||||||
|
])}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
Icon,
|
Icon,
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import SvelteMarkdown from 'svelte-markdown'
|
|
||||||
|
|
||||||
export let data: {
|
export let data: {
|
||||||
user: GetPersonDetailsResponse
|
user: GetPersonDetailsResponse
|
||||||
|
|||||||
Reference in new issue
Block a user