diff --git a/src/components/Article/Comment/Comment.tsx b/src/components/Article/Comment/Comment.tsx index d22a8da7..d5b794e6 100644 --- a/src/components/Article/Comment/Comment.tsx +++ b/src/components/Article/Comment/Comment.tsx @@ -46,14 +46,13 @@ export const Comment = (props: Props) => { const canEdit = createMemo( () => Boolean(author()?.id) && - (props.comment?.created_by?.id === author().id || session()?.user?.roles.includes('editor')), + (props.comment?.created_by?.slug === author().slug || session()?.user?.roles.includes('editor')), ) - const comment = createMemo(() => props.comment) - const body = createMemo(() => (comment().body || '').trim()) + const body = createMemo(() => (props.comment.body || '').trim()) const remove = async () => { - if (comment()?.id) { + if (props.comment?.id) { try { const isConfirmed = await showConfirm({ confirmBody: t('Are you sure you want to delete this comment?'), @@ -63,7 +62,7 @@ export const Comment = (props: Props) => { }) if (isConfirmed) { - await deleteReaction(comment().id) + await deleteReaction(props.comment.id) await showSnackbar({ body: t('Comment successfully deleted') }) } @@ -113,8 +112,10 @@ export const Comment = (props: Props) => { return (