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
1 file
+ 6
6
Compare changes
  • Side-by-side
  • Inline
@@ -80,7 +80,7 @@ export const authorCanViewReportsDetails = (
collection = {},
fragmentId,
) => {
const isAuthor = currentUserIsAuthor(state)
const isAuthor = currentUserIsAuthor(state, fragmentId)
return (
authorCanViewReportsDetailsStatuses.includes(
get(collection, 'status', 'draft'),
@@ -153,7 +153,7 @@ export const canAuthorViewEditorialComments = (
collection = {},
fragmentId,
) => {
const isAuthor = currentUserIsAuthor(state)
const isAuthor = currentUserIsAuthor(state, fragmentId)
return (
isAuthor &&
!cannotAuthorViewEditorialCommentsStatuses.includes(
@@ -251,10 +251,10 @@ export const canMakeRevision = (state, collection = {}, fragment = {}) => {
)
}
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 currentUserIsAuthor = (state, fragmentId) => {
const { id: userId } = selectCurrentUser(state)
const authors = get(state, `fragments.${fragmentId}.authors`, [])
return !!authors.find(a => a.id === userId)
}
export const getUserPermissions = ({ teams = [] }) =>