Merge pull request #297 from openedx/revert-283-add-response-fix

Revert "fix: add response duplication button fixed"
This commit is contained in:
AsadAzam
2022-09-21 20:19:51 +05:00
committed by GitHub

View File

@@ -46,12 +46,12 @@ function usePostComments(postId, endorsed = null) {
page: 1,
}));
}, [postId]);
return [
return {
comments,
hasMorePages,
isLoading,
handleLoadMoreResponses,
];
};
}
function DiscussionCommentsView({
@@ -61,20 +61,15 @@ function DiscussionCommentsView({
endorsed,
isClosed,
}) {
const [
const {
comments,
hasMorePages,
isLoading,
handleLoadMoreResponses,
] = usePostComments(postId, endorsed);
} = usePostComments(postId, endorsed);
const sortedComments = useMemo(() => orderBy(comments, ['endorsed', 'createdAt'],
['desc', 'desc']));
const [commentList] = usePostComments(postId, EndorsementStatus.UNENDORSED);
const showAddResponse = endorsed === EndorsementStatus.ENDORSED ? !commentList.length : true;
return (
<>
<div className="mx-4 text-primary-700" role="heading" aria-level="2" style={{ lineHeight: '28px' }}>
@@ -86,7 +81,7 @@ function DiscussionCommentsView({
{sortedComments.map(comment => (
<Comment comment={comment} key={comment.id} postType={postType} isClosedPost={isClosed} />
))}
{!!sortedComments.length && !isClosed && showAddResponse
{!!sortedComments.length && !isClosed
&& <ResponseEditor postId={postId} addWrappingDiv />}
{hasMorePages && !isLoading && (
<Button