diff --git a/src/discussions/comments/comment/Comment.jsx b/src/discussions/comments/comment/Comment.jsx index df011a0a..1d0cf5e2 100644 --- a/src/discussions/comments/comment/Comment.jsx +++ b/src/discussions/comments/comment/Comment.jsx @@ -10,7 +10,9 @@ import { Button, useToggle } from '@edx/paragon'; import HTMLLoader from '../../../components/HTMLLoader'; import { ContentActions } from '../../../data/constants'; import { AlertBanner, DeleteConfirmation, EndorsedAlertBanner } from '../../common'; +import { selectBlackoutDate } from '../../data/selectors'; import { fetchThread } from '../../posts/data/thunks'; +import { inBlackoutDateRange } from '../../utils'; import CommentIcons from '../comment-icons/CommentIcons'; import { selectCommentCurrentPage, selectCommentHasMorePages, selectCommentResponses } from '../data/selectors'; import { editComment, fetchCommentResponses, removeComment } from '../data/thunks'; @@ -36,6 +38,7 @@ function Comment({ const [isReplying, setReplying] = useState(false); const hasMorePages = useSelector(selectCommentHasMorePages(comment.id)); const currentPage = useSelector(selectCommentCurrentPage(comment.id)); + const blackoutDateRange = useSelector(selectBlackoutDate); useEffect(() => { // If the comment has a parent comment, it won't have any children, so don't fetch them. @@ -124,13 +127,18 @@ function Comment({ /> ) : ( <> - {!isClosedPost + {(!isClosedPost && !inBlackoutDateRange(blackoutDateRange)) && ( - + )} > + ) )} diff --git a/src/discussions/comments/comment/ResponseEditor.jsx b/src/discussions/comments/comment/ResponseEditor.jsx index e0f650bd..2035bd80 100644 --- a/src/discussions/comments/comment/ResponseEditor.jsx +++ b/src/discussions/comments/comment/ResponseEditor.jsx @@ -2,10 +2,13 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; +import { useSelector } from 'react-redux'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Button } from '@edx/paragon'; +import { selectBlackoutDate } from '../../data/selectors'; +import { inBlackoutDateRange } from '../../utils'; import messages from '../messages'; import CommentEditor from './CommentEditor'; @@ -20,6 +23,8 @@ function ResponseEditor({ setAddingResponse(false); }, [postId]); + const blackoutDateRange = useSelector(selectBlackoutDate); + return addingResponse ? (