diff --git a/src/discussions/data/hooks.js b/src/discussions/data/hooks.js index f4deb82a..ca3cf58b 100644 --- a/src/discussions/data/hooks.js +++ b/src/discussions/data/hooks.js @@ -224,10 +224,6 @@ export const useUserPostingEnabled = () => { return (isPostingEnabled || isPrivileged); }; -function camelToConstant(string) { - return string.replace(/[A-Z]/g, (match) => `_${match}`).toUpperCase(); -} - export const useTourConfiguration = () => { const intl = useIntl(); const dispatch = useDispatch(); @@ -252,7 +248,7 @@ export const useTourConfiguration = () => { enabled: tour && Boolean(tour.enabled && tour.showTour && !enableInContextSidebar), onDismiss: () => handleOnDismiss(tour.id), onEnd: () => handleOnEnd(tour.id), - checkpoints: tourCheckpoints(intl)[camelToConstant(tour.tourName)], + checkpoints: tourCheckpoints(intl)[tour.tourName], } )) ), [tours, enableInContextSidebar]); diff --git a/src/discussions/posts/post-editor/PostEditor.jsx b/src/discussions/posts/post-editor/PostEditor.jsx index f6713907..7670feb9 100644 --- a/src/discussions/posts/post-editor/PostEditor.jsx +++ b/src/discussions/posts/post-editor/PostEditor.jsx @@ -43,6 +43,7 @@ import { selectNonCoursewareTopics as inContextNonCourseware, } from '../../in-context-topics/data/selectors'; import { selectCoursewareTopics, selectNonCoursewareIds, selectNonCoursewareTopics } from '../../topics/data/selectors'; +import { updateUserDiscussionsTourByName } from '../../tours/data'; import { discussionsPath, formikCompatibleHandler, isFormikFieldInvalid, useCommentsPagePath, } from '../../utils'; @@ -91,6 +92,21 @@ const PostEditor = ({ editReasonCode: Yup.string().required(intl.formatMessage(messages.editReasonCodeError)), }; + const enableNotifyAllLearnersTour = useCallback((enabled) => { + const data = { + enabled, + tourName: 'notify_all_learners', + }; + dispatch(updateUserDiscussionsTourByName(data)); + }, []); + + useEffect(() => { + enableNotifyAllLearnersTour(true); + return () => { + enableNotifyAllLearnersTour(false); + }; + }, []); + const canSelectCohort = useCallback((tId) => { // If the user isn't privileged, they can't edit the cohort. // If the topic is being edited the cohort can't be changed. @@ -427,6 +443,7 @@ const PostEditor = ({