Skip to content
Snippets Groups Projects
Commit 55965d3c authored by Tania Fecheta's avatar Tania Fecheta
Browse files

feat(reviewerReports): filter reccomendations reviwers see

parent 1aa94667
No related branches found
No related tags found
3 merge requests!176Sprint 24,!171Sprint 24,!166Hin 1051 reviewers see all reports
......@@ -69,6 +69,7 @@ export const canViewReviewersDetails = (state, collection = {}) => {
const authorAndReviewersCanViewReportsDetailsStatuses = [
'revisionRequested',
'underReview',
'pendingApproval',
'rejected',
'accepted',
......
import React from 'react'
import { compose } from 'recompose'
import {
ReviewerReport,
ContextualBox,
......@@ -20,12 +21,13 @@ const SubmittedReports = ({ reports }) => (
</Row>
)
const ReviewReportCard = ({
const ReviewerReports = ({
journal,
reports,
previewFile,
downloadFile,
isLatestVersion,
currentUser,
}) => (
<ContextualBox
label={isLatestVersion ? 'Your Report' : 'Reviewer Reports'}
......@@ -41,10 +43,10 @@ const ReviewReportCard = ({
onPreview={previewFile}
report={report}
reviewerIndex={index + 1}
showOwner
showOwner={report.userId === currentUser.id}
/>
))}
</ContextualBox>
)
export default withFileDownload(withFilePreview(ReviewReportCard))
export default compose(withFileDownload, withFilePreview)(ReviewerReports)
......@@ -73,17 +73,15 @@ const filterAuthorRecommendations = (recommendations, status, isLast) => {
}
const filterReviewerRecommendations = (recommendations, user) => {
const ownRecommendationFromCurrentFragment = recommendations.find(
r => r.userId === user.id,
)
if (ownRecommendationFromCurrentFragment)
const ownRecommendation = recommendations.find(r => r.userId === user.id)
if (ownRecommendation)
return recommendations
.filter(
r => r.submittedOn || r.recommendationType === 'editorRecommendation',
)
.map(
r =>
r.userId !== ownRecommendationFromCurrentFragment.userId
r.userId !== ownRecommendation.userId
? { ...r, comments: r.comments.filter(c => c.public === true) }
: { ...r },
)
......
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