From 00491b583a3dfd42024a5905b3f5b585d0d024d2 Mon Sep 17 00:00:00 2001 From: Tyler Gauntlett Date: Tue, 17 Oct 2023 18:13:13 -0400 Subject: [PATCH 1/2] feat(threaded-replies): hide replies button on resolved comments --- .../activity-feed/activity-feed/ActivityItem.scss | 2 +- .../activity-feed/comment/BaseComment.js | 5 ++++- .../activity-feed/comment/CreateReply.scss | 3 +++ .../activity-feed/comment/__tests__/Replies.test.js | 13 +++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.scss b/src/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.scss index cd0d6dc876..370ce1e4a9 100644 --- a/src/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.scss +++ b/src/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.scss @@ -6,7 +6,7 @@ // This brittle selector is here in order to only select the parent BaseComment and not the BaseComments which constitute its replies. & > div { - padding: $bdl-grid-unit * 3 $bdl-grid-unit * 3 $bdl-grid-unit * 5; + padding: $bdl-grid-unit * 3 $bdl-grid-unit * 3 $bdl-grid-unit; } &.bcs-is-hoverable:hover { diff --git a/src/elements/content-sidebar/activity-feed/comment/BaseComment.js b/src/elements/content-sidebar/activity-feed/comment/BaseComment.js index a09213703f..352de2afe3 100644 --- a/src/elements/content-sidebar/activity-feed/comment/BaseComment.js +++ b/src/elements/content-sidebar/activity-feed/comment/BaseComment.js @@ -234,6 +234,7 @@ export const BaseComment = ({ onReplyDelete={onReplyDelete} onReplySelect={onSelect} onShowReplies={onShowReplies} + parentStatus={status} replies={replies} repliesTotalCount={repliesTotalCount} /> @@ -257,6 +258,7 @@ type RepliesProps = { onReplyDelete?: ({ id: string, permissions?: BoxCommentPermission }) => void, onReplySelect?: (isSelected: boolean) => void, onShowReplies?: () => void, + parentStatus?: string, replies: CommentType[], repliesTotalCount?: number, translations?: Translations, @@ -276,6 +278,7 @@ export const Replies = ({ onReplySelect = noop, onShowReplies, onHideReplies, + parentStatus, replies, repliesTotalCount = 0, translations, @@ -346,7 +349,7 @@ export const Replies = ({ })} - {!!onReplyCreate && ( + {parentStatus !== COMMENT_STATUS_RESOLVED && !!onReplyCreate && ( () => 'Avatar'); jest.mock('react-intl', () => ({ @@ -221,6 +222,18 @@ describe('elements/content-sidebar/ActivityFeed/comment/Replies', () => { expect(hideReplies).not.toBeCalled(); }); + test('should hide reply button for resolved parent comments', () => { + getWrapper({ parentStatus: COMMENT_STATUS_RESOLVED }); + + expect(screen.queryByRole('button', { name: 'Reply' })).not.toBeInTheDocument(); + }); + + test('should show reply button for unresolved parent comments', () => { + getWrapper({ parentStatus: COMMENT_STATUS_OPEN }); + + expect(screen.queryByRole('button', { name: 'Reply' })).toBeInTheDocument(); + }); + test.each` onShowReplies | onHideReplies ${showReplies} | ${undefined} From 51ada4e3f75bfb22f9b55249d1ffb63c76fd7d5c Mon Sep 17 00:00:00 2001 From: Tyler Gauntlett Date: Tue, 17 Oct 2023 20:56:00 -0400 Subject: [PATCH 2/2] feat(threaded-replies): removed extraneous style --- .../content-sidebar/activity-feed/comment/CreateReply.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/elements/content-sidebar/activity-feed/comment/CreateReply.scss b/src/elements/content-sidebar/activity-feed/comment/CreateReply.scss index 91e82a5465..0b18234f6e 100644 --- a/src/elements/content-sidebar/activity-feed/comment/CreateReply.scss +++ b/src/elements/content-sidebar/activity-feed/comment/CreateReply.scss @@ -1,7 +1,6 @@ @import '../../../common/variables'; .bcs-CreateReply { - margin-top: $bdl-grid-unit * 2; margin-bottom: $bdl-grid-unit * 4; .bcs-CreateReply-toggle {