diff --git a/src/redux/studio-mutations.js b/src/redux/studio-mutations.js index 3987d5e33..be7bb8f97 100644 --- a/src/redux/studio-mutations.js +++ b/src/redux/studio-mutations.js @@ -191,7 +191,7 @@ const mutateStudioCommentsAllowed = shouldAllow => ((dispatch, getState) => { api({ host: '', uri: `/site-api/comments/gallery/${studioId}/toggle-comments/`, - method: 'PUT', + method: 'POST', useCsrf: true }, (err, body, res) => { const error = normalizeError(err, body, res); diff --git a/src/redux/studio-permissions.js b/src/redux/studio-permissions.js index 438d2810b..b2d7caad7 100644 --- a/src/redux/studio-permissions.js +++ b/src/redux/studio-permissions.js @@ -25,6 +25,10 @@ const selectCanDeleteCommentWithoutConfirm = state => selectIsAdmin(state); const selectCanFollowStudio = state => selectIsLoggedIn(state); +// Matching existing behavior, only the creator is allowed to toggle comments. +const selectCanEditCommentsAllowed = state => selectIsAdmin(state) || isCreator(state); +const selectCanEditOpenToAll = state => selectIsAdmin(state) || isManager(state); + export { selectCanEditInfo, selectCanAddProjects, @@ -33,5 +37,7 @@ export { selectCanDeleteComment, selectCanDeleteCommentWithoutConfirm, selectCanReportComment, - selectCanRestoreComment + selectCanRestoreComment, + selectCanEditCommentsAllowed, + selectCanEditOpenToAll }; diff --git a/src/views/studio/studio-comments-allowed.jsx b/src/views/studio/studio-comments-allowed.jsx index b3a6393c8..ce464fbe1 100644 --- a/src/views/studio/studio-comments-allowed.jsx +++ b/src/views/studio/studio-comments-allowed.jsx @@ -4,13 +4,12 @@ import PropTypes from 'prop-types'; import {connect} from 'react-redux'; import {selectStudioCommentsAllowed, selectIsLoadingInfo} from '../../redux/studio'; -import {selectCanEditInfo} from '../../redux/studio-permissions'; import { mutateStudioCommentsAllowed, selectIsMutatingCommentsAllowed, selectCommentsAllowedMutationError } from '../../redux/studio-mutations'; const StudioCommentsAllowed = ({ - commentsAllowedError, isLoading, isMutating, commentsAllowed, canEditInfo, handleUpdate + commentsAllowedError, isLoading, isMutating, commentsAllowed, handleUpdate }) => (