Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/admin/src/comments/components/comment-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMen
import {type Comment, usePinComment, useUnpinComment} from '@tryghost/admin-x-framework/api/comments';
import {DisableCommentingDialog} from './disable-commenting-dialog';
import {LucideIcon} from '@tryghost/shade/utils';
import {useCommentsPinningEnabled} from '@/comments/hooks/use-comments-pinning-enabled';
import {useDisableMemberCommenting, useEnableMemberCommenting} from '@tryghost/admin-x-framework/api/members';
import {useState} from 'react';

Expand All @@ -18,13 +17,12 @@ export function CommentMenu({
const {mutate: pinComment} = usePinComment();
const {mutate: unpinComment} = useUnpinComment();
const [disableDialogOpen, setDisableDialogOpen] = useState(false);
const commentsPinningEnabled = useCommentsPinningEnabled();

const {id: commentId, post, member} = comment;
const postUrl = post?.url;
const memberId = member?.id;
const canComment = member?.can_comment;
const canPin = commentsPinningEnabled && !comment.parent_id && comment.status !== 'deleted';
const canPin = !comment.parent_id && comment.status !== 'deleted';

const handleDisableCommenting = (hideComments: boolean) => {
if (memberId) {
Expand Down
6 changes: 2 additions & 4 deletions apps/admin/src/comments/components/comment-thread-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {CommentMetrics} from './comment-metrics';
import {buildThreadLink} from './thread-link';
import {Link, useSearchParams} from '@tryghost/admin-x-framework';
import {LucideIcon, cn} from '@tryghost/shade/utils';
import {useCommentsPinningEnabled} from '@/comments/hooks/use-comments-pinning-enabled';

function RepliesLine({hasReplies}: {hasReplies: boolean}) {
if (!hasReplies) {
Expand Down Expand Up @@ -36,7 +35,6 @@ function CommentRow({comment, dislikesEnabled, isReply = false, isSelectedCommen
const {mutate: hideComment} = useHideComment();
const {mutate: showComment} = useShowComment();
const {mutate: unpinComment} = useUnpinComment();
const commentsPinningEnabled = useCommentsPinningEnabled();

// Check replies array for loaded objects, or count.direct_replies for unloaded
// TODO: remove count.replies fallback once backend is fully rolled out
Expand Down Expand Up @@ -64,10 +62,10 @@ function CommentRow({comment, dislikesEnabled, isReply = false, isSelectedCommen
canComment={comment.member?.can_comment}
createdAt={comment.created_at}
isHidden={comment.status === 'hidden'}
isPinned={commentsPinningEnabled && comment.pinned}
isPinned={comment.pinned}
memberId={comment.member?.id}
memberName={comment.member?.name}
onUnpinClick={commentsPinningEnabled ? () => unpinComment({id: comment.id}) : undefined}
onUnpinClick={() => unpinComment({id: comment.id})}
/>

{comment.in_reply_to_snippet && isSelectedComment && (
Expand Down
6 changes: 2 additions & 4 deletions apps/admin/src/comments/components/comments-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {Link, useSearchParams} from '@tryghost/admin-x-framework';
import {LoadMoreButton, useInfiniteVirtualScroll, useScrollRestoration, useVirtualListWindow} from '@/shared/virtual-list';
import {LucideIcon, cn} from '@tryghost/shade/utils';
import {forwardRef, useEffect, useRef, useState} from 'react';
import {useCommentsPinningEnabled} from '@/comments/hooks/use-comments-pinning-enabled';

const SpacerRow = ({height}: { height: number }) => (
<div aria-hidden="true" className="flex">
Expand Down Expand Up @@ -67,7 +66,6 @@ function CommentsList({
const {mutate: hideComment} = useHideComment();
const {mutate: showComment} = useShowComment();
const {mutate: unpinComment} = useUnpinComment();
const commentsPinningEnabled = useCommentsPinningEnabled();

const handleCloseSidebar = (open: boolean) => {
setThreadSidebarOpen(open);
Expand Down Expand Up @@ -157,13 +155,13 @@ function CommentsList({
canComment={item.member?.can_comment}
createdAt={item.created_at}
isHidden={item.status === 'hidden'}
isPinned={commentsPinningEnabled && item.pinned}
isPinned={item.pinned}
memberId={item.member?.id}
memberName={item.member?.name}
postTitle={item.post?.title}
onAuthorClick={item.member?.id ? () => onAddFilter('author', item.member!.id) : undefined}
onPostClick={item.post?.id ? () => onAddFilter('post', item.post!.id) : undefined}
onUnpinClick={commentsPinningEnabled ? () => unpinComment({id: item.id}) : undefined}
onUnpinClick={() => unpinComment({id: item.id})}
/>

{item.in_reply_to_snippet && (
Expand Down
11 changes: 0 additions & 11 deletions apps/admin/src/comments/hooks/use-comments-pinning-enabled.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/comments-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tryghost/comments-ui",
"type": "module",
"version": "1.5.22",
"version": "1.6.0",
"license": "MIT",
"repository": "https://github.com/TryGhost/Ghost",
"author": "Ghost Foundation",
Expand Down
Loading
Loading