diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js index fcdffadd55de5c0dd6657160c87f67146252be42..1b60986bd7466b464784786068064bd870564f2b 100644 --- a/packages/component-faraday-selectors/src/index.js +++ b/packages/component-faraday-selectors/src/index.js @@ -108,6 +108,29 @@ export const canEICViewEditorialComments = (state, collection = {}) => { return isEIC && canEICViewEditorialCommentsStatuses.includes(status) } +const cannotAuthorViewEditorialCommentsStatuses = [ + 'draft', + 'technicalChecks', + 'submitted', + 'heInvited', + 'heAssigned', + 'reviewersInvited', +] + +export const canAuthorViewEditorialComments = ( + state, + collection = {}, + fragmentId, +) => { + const isAuthor = currentUserIsAuthor(state, fragmentId) + return ( + isAuthor && + !cannotAuthorViewEditorialCommentsStatuses.includes( + get(collection, 'status', 'draft'), + ) + ) +} + export const canViewEditorialComments = ( state, collection = {},