Skip to content
Snippets Groups Projects

fix(Only authors can see Reviewer Reports): Only authors can see Reviewer Reports

Merged Iosif Boanca requested to merge HIN-1123 into develop
Files
2
@@ -80,7 +80,7 @@ export const authorCanViewReportsDetails = (
collection = {},
fragmentId,
) => {
const isAuthor = currentUserIsAuthor(state, fragmentId)
const isAuthor = currentUserIsAuthor(state)
return (
authorCanViewReportsDetailsStatuses.includes(
get(collection, 'status', 'draft'),
@@ -153,7 +153,7 @@ export const canAuthorViewEditorialComments = (
collection = {},
fragmentId,
) => {
const isAuthor = currentUserIsAuthor(state, fragmentId)
const isAuthor = currentUserIsAuthor(state)
return (
isAuthor &&
!cannotAuthorViewEditorialCommentsStatuses.includes(
@@ -251,13 +251,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 = [] }) =>