diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js index 0ab630ff6cb341f42ab8850b631ba4d270f26f10..c948890e60bff98dd99aeeeb1c9c7ee062e0b62c 100644 --- a/packages/component-faraday-selectors/src/index.js +++ b/packages/component-faraday-selectors/src/index.js @@ -79,7 +79,7 @@ export const authorCanViewReportsDetails = ( collection = {}, fragmentId, ) => { - const isAuthor = currentUserIsAuthor(state, fragmentId) + const isAuthor = currentUserIsAuthor(state) return ( authorCanViewReportsDetailsStatuses.includes( get(collection, 'status', 'draft'), @@ -152,7 +152,7 @@ export const canAuthorViewEditorialComments = ( collection = {}, fragmentId, ) => { - const isAuthor = currentUserIsAuthor(state, fragmentId) + const isAuthor = currentUserIsAuthor(state) return ( isAuthor && !cannotAuthorViewEditorialCommentsStatuses.includes( @@ -245,13 +245,10 @@ export const canMakeRevision = (state, collection = {}, fragment = {}) => { ) } -export const currentUserIsAuthor = (state, id) => { - const permissions = getUserPermissions(state) - - return permissions - .filter(f => f.role === 'author') - .map(p => p.objectId) - .includes(id) +export const currentUserIsAuthor = state => { + const authors = state.collections[0].owners.map(e => e.id) + const user = state.currentUser.user.id + return authors.includes(user) } export const getUserPermissions = ({ teams = [] }) => diff --git a/packages/component-manuscript/src/components/ReviewsAndReports.js b/packages/component-manuscript/src/components/ReviewsAndReports.js index d2efda6e7b5bca2101fa9f7b0dfdbbb7e7a9c8c9..37019432c1b6dd90e6a793a271158d446968bf3f 100644 --- a/packages/component-manuscript/src/components/ReviewsAndReports.js +++ b/packages/component-manuscript/src/components/ReviewsAndReports.js @@ -106,7 +106,7 @@ export default compose( reviewers: selectReviewers(state), fetchingReviewers: selectFetchingReviewers(state), isReviewer: currentUserIsReviewer(state, version.id), - isAuthor: currentUserIsAuthor(state, version.id), + isAuthor: currentUserIsAuthor(state), recommendations: selectReviewRecommendations(state, version.id), canViewReports: canViewReports(state, project.id), }),