0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Updated some of the logic for the dropdowns for hidden, etc

refs https://github.com/TryGhost/Team/issues/1693
This commit is contained in:
James Morris 2022-07-20 17:26:29 +01:00
parent 48b4aaf838
commit 55f650f964
2 changed files with 22 additions and 3 deletions

View file

@ -58,8 +58,8 @@ const Comment = (props) => {
<p dangerouslySetInnerHTML={html} className="gh-comment-content text-[16.5px] leading-normal"></p>
</div>
<div className="ml-14 flex gap-5 items-center">
<Like comment={comment} />
{canReply && (isNotPublished || !props.parent) && <Reply comment={comment} toggleReply={toggleReplyMode} isReplying={isInReplyMode} />}
{!isNotPublished && <Like comment={comment} />}
{!isNotPublished && (canReply && (isNotPublished || !props.parent) && <Reply comment={comment} toggleReply={toggleReplyMode} isReplying={isInReplyMode} />)}
<div className="text-sm text-neutral-400 dark:text-[rgba(255,255,255,0.5)] font-sans">{formatRelativeTime(comment.created_at)}</div>
<More comment={comment} toggleEdit={toggleEditMode} />
</div>

View file

@ -10,9 +10,28 @@ const CommentContextMenu = (props) => {
const isAuthor = member && comment.member?.uuid === member?.uuid;
const isAdmin = !!admin;
let contextMenu = null;
if (comment.status === 'published') {
if (isAuthor) {
contextMenu = <AuthorContextMenu comment={comment} close={props.close} toggleEdit={props.toggleEdit} />;
} else {
if (isAdmin) {
contextMenu = <AdminContextMenu comment={comment} close={props.close}/>;
} else {
contextMenu = <NotAuthorContextMenu comment={comment} close={props.close}/>;
}
}
} else {
if (isAdmin) {
contextMenu = <AdminContextMenu comment={comment} close={props.close}/>;
} else {
return null;
}
}
return (
<div className="min-w-[170px] bg-white absolute font-sans rounded py-3 px-4 shadow-lg text-sm whitespace-nowrap z-10 dark:bg-zinc-900 dark:text-white">
{isAuthor && comment.status === 'published' ? <AuthorContextMenu comment={comment} close={props.close} toggleEdit={props.toggleEdit} /> : (isAdmin ? <AdminContextMenu comment={comment} close={props.close}/> : <NotAuthorContextMenu comment={comment} close={props.close}/>)}
{contextMenu}
</div>
);
};