fix: disable add comment button
This commit is contained in:
1 file changed
+13
-12
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/state'
|
|
||||||
import { profile } from '$lib/auth.svelte'
|
import { profile } from '$lib/auth.svelte'
|
||||||
import CommentForm from '$lib/components/lemmy/comment/CommentForm.svelte'
|
import CommentForm from '$lib/components/lemmy/comment/CommentForm.svelte'
|
||||||
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
||||||
@@ -7,7 +6,6 @@
|
|||||||
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.svelte'
|
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.svelte'
|
||||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { instance } from '$lib/instance.svelte'
|
|
||||||
import type {
|
import type {
|
||||||
CommentSortType,
|
CommentSortType,
|
||||||
GetCommentsResponse,
|
GetCommentsResponse,
|
||||||
@@ -54,7 +52,19 @@
|
|||||||
{#if profile.data?.jwt}
|
{#if profile.data?.jwt}
|
||||||
{#if !commenting}
|
{#if !commenting}
|
||||||
<EndPlaceholder>
|
<EndPlaceholder>
|
||||||
<Button color="primary" rounding="xl" onclick={() => (commenting = true)}>
|
<Button
|
||||||
|
color="primary"
|
||||||
|
rounding="xl"
|
||||||
|
disabled={(post.post_view.post.locked ||
|
||||||
|
post.post_view.banned_from_community) &&
|
||||||
|
!(
|
||||||
|
profile.data?.user?.local_user_view.local_user.admin ||
|
||||||
|
profile.data?.user?.moderates
|
||||||
|
.map(c => c.community.id)
|
||||||
|
.includes(post.community_view.community.id)
|
||||||
|
)}
|
||||||
|
onclick={() => (commenting = true)}
|
||||||
|
>
|
||||||
<Icon src={PlusCircle} size="16" micro />
|
<Icon src={PlusCircle} size="16" micro />
|
||||||
{$t('routes.post.addComment')}
|
{$t('routes.post.addComment')}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -93,15 +103,6 @@
|
|||||||
oncomment={comment => {
|
oncomment={comment => {
|
||||||
comments.comments = [comment.comment_view, ...comments.comments]
|
comments.comments = [comment.comment_view, ...comments.comments]
|
||||||
}}
|
}}
|
||||||
locked={(post.post_view.post.locked &&
|
|
||||||
!(
|
|
||||||
profile.data?.user?.local_user_view.local_user.admin ||
|
|
||||||
profile.data?.user?.moderates
|
|
||||||
.map(c => c.community.id)
|
|
||||||
.includes(post.community_view.community.id)
|
|
||||||
)) ||
|
|
||||||
page.params.instance.toLowerCase() != instance.data.toLowerCase()}
|
|
||||||
banned={post.community_view.banned_from_community}
|
|
||||||
onfocus={() => (commenting = true)}
|
onfocus={() => (commenting = true)}
|
||||||
tools={commenting}
|
tools={commenting}
|
||||||
preview={commenting}
|
preview={commenting}
|
||||||
|
|||||||
Reference in new issue
Block a user