Skip to content
Snippets Groups Projects
Commit d1f3f459 authored by Iosif Boanca's avatar Iosif Boanca
Browse files

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

parent d211a9cd
No related branches found
No related tags found
3 merge requests!160Update staging with master features,!150Develop,!144fix(Only authors can see Reviewer Reports): Only authors can see Reviewer Reports
......@@ -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 = [] }) =>
......
......@@ -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),
}),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment