diff --git a/src/discussions/comments/comment/Comment.jsx b/src/discussions/comments/comment/Comment.jsx
index 048288fc..733dc9b8 100644
--- a/src/discussions/comments/comment/Comment.jsx
+++ b/src/discussions/comments/comment/Comment.jsx
@@ -11,9 +11,8 @@ import HTMLLoader from '../../../components/HTMLLoader';
import { ContentActions } from '../../../data/constants';
import { AlertBanner, Confirmation, EndorsedAlertBanner } from '../../common';
import { DiscussionContext } from '../../common/context';
-import { selectBlackoutDate } from '../../data/selectors';
+import { useUserCanAddThreadInBlackoutDate } from '../../data/hooks';
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';
@@ -40,7 +39,7 @@ function Comment({
const [isReplying, setReplying] = useState(false);
const hasMorePages = useSelector(selectCommentHasMorePages(comment.id));
const currentPage = useSelector(selectCommentCurrentPage(comment.id));
- const blackoutDateRange = useSelector(selectBlackoutDate);
+ const userCanAddThreadInBlackoutDate = useUserCanAddThreadInBlackoutDate();
const {
courseId,
} = useContext(DiscussionContext);
@@ -158,18 +157,18 @@ function Comment({
/>
) : (
<>
- {(!isClosedPost && !inBlackoutDateRange(blackoutDateRange))
+ {!isClosedPost && userCanAddThreadInBlackoutDate
&& (
-
+
)}
>
diff --git a/src/discussions/comments/comment/ResponseEditor.jsx b/src/discussions/comments/comment/ResponseEditor.jsx
index 1ca8763b..26889832 100644
--- a/src/discussions/comments/comment/ResponseEditor.jsx
+++ b/src/discussions/comments/comment/ResponseEditor.jsx
@@ -2,14 +2,12 @@ import React, { useContext, 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 { DiscussionContext } from '../../common/context';
-import { selectBlackoutDate } from '../../data/selectors';
-import { inBlackoutDateRange } from '../../utils';
+import { useUserCanAddThreadInBlackoutDate } from '../../data/hooks';
import messages from '../messages';
import CommentEditor from './CommentEditor';
@@ -20,13 +18,12 @@ function ResponseEditor({
}) {
const { inContext } = useContext(DiscussionContext);
const [addingResponse, setAddingResponse] = useState(false);
+ const userCanAddThreadInBlackoutDate = useUserCanAddThreadInBlackoutDate();
useEffect(() => {
setAddingResponse(false);
}, [postId]);
- const blackoutDateRange = useSelector(selectBlackoutDate);
-
return addingResponse
? (
@@ -37,7 +34,7 @@ function ResponseEditor({
/>
)
- : !inBlackoutDateRange(blackoutDateRange) && (
+ : userCanAddThreadInBlackoutDate && (