Skip to content
Snippets Groups Projects

Hin 1014

Merged Anca Ursachi requested to merge HIN-1014 into develop
7 files
+ 98
21
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -53,6 +53,7 @@ const cannotViewReviewersDetails = [
'submitted',
'heInvited',
]
export const canViewReviewersDetails = (state, collection = {}) => {
if (cannotViewReviewersDetails.includes(get(collection, 'status', 'draft'))) {
return false
@@ -60,6 +61,41 @@ export const canViewReviewersDetails = (state, collection = {}) => {
return canViewReports(state, collection.id)
}
const canHeViewEditorialCommentsStatuses = [
'revisionRequested',
'rejected',
'accepted',
'inQA',
]
export const canHeViewEditorialComments = (state, collection = {}) => {
const isHE = isHEToManuscript(state, collection.id)
const status = get(collection, 'status', 'draft')
return isHE && canHeViewEditorialCommentsStatuses.includes(status)
}
const canEICViewEditorialCommentsStatuses = ['rejected', 'accepted', 'inQA']
export const canEICViewEditorialComments = (state, collection = {}) => {
const isEIC = currentUserIs(state, 'adminEiC')
const status = get(collection, 'status', 'draft')
return isEIC && canEICViewEditorialCommentsStatuses.includes(status)
}
export const canViewEditorialComments = (
state,
collection = {},
fragmentId,
) => {
const editorialRecommentations = getFragmentEditorialComments(
state,
fragmentId,
)
return (
(canHeViewEditorialComments(state, collection) ||
canEICViewEditorialComments(state, collection)) &&
editorialRecommentations.length > 0
)
}
export const getUserToken = ({ currentUser }) =>
get(currentUser, 'user.token', '')
@@ -254,6 +290,10 @@ export const getFragmentReviewerRecommendations = (state, fragmentId) =>
getFragmentRecommendations(state, fragmentId).filter(
r => r.recommendationType === 'review',
)
const getFragmentEditorialComments = (state, fragmentId) =>
getFragmentRecommendations(state, fragmentId).filter(
r => r.recommendationType === 'editorRecommendation',
)
const getOwnRecommendations = (state, fragmentId) =>
chain(state)