Skip to content
Snippets Groups Projects
Commit 0f228e5a authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

refactor(reviewers): refresh breakdown after revoke/resend actions

parent 9c2cf3d0
No related branches found
No related tags found
1 merge request!8Sprint #10
...@@ -34,7 +34,7 @@ const ReviewsAndReports = ({ project, reviewers = [] }) => ( ...@@ -34,7 +34,7 @@ const ReviewsAndReports = ({ project, reviewers = [] }) => (
<Root> <Root>
<Expandable <Expandable
label="Reviewers & Reports" label="Reviewers & Reports"
rightHTML={<ReviewerBreakdown values={project.invitations || []} />} rightHTML={<ReviewerBreakdown type="reviewer" values={reviewers || []} />}
startExpanded startExpanded
> >
<Tabs activeKey={1} sections={getTabSections(project.id, reviewers)} /> <Tabs activeKey={1} sections={getTabSections(project.id, reviewers)} />
......
...@@ -15,6 +15,7 @@ import { ...@@ -15,6 +15,7 @@ import {
inviteReviewer, inviteReviewer,
selectFetchingInvite, selectFetchingInvite,
selectReviewersError, selectReviewersError,
getCollectionReviewers,
} from '../../redux/reviewers' } from '../../redux/reviewers'
const ResendRevoke = withTheme( const ResendRevoke = withTheme(
...@@ -55,15 +56,13 @@ const TR = ({ ...@@ -55,15 +56,13 @@ const TR = ({
</DateText> </DateText>
</td> </td>
<td> {r.submittedOn ? `: ${renderTimestamp(r.submittedOn)}` : ''} </td> <td> {r.submittedOn ? `: ${renderTimestamp(r.submittedOn)}` : ''} </td>
<td> <td width={100}>
{r.status === 'pending' ? ( {r.status === 'pending' && (
<ResendRevoke <ResendRevoke
showConfirmResend={showConfirmResend(r)} showConfirmResend={showConfirmResend(r)}
showConfirmRevoke={showConfirmRevoke(r.invitationId)} showConfirmRevoke={showConfirmRevoke(r.invitationId)}
status={r.status} status={r.status}
/> />
) : (
<div />
)} )}
</td> </td>
</Row> </Row>
...@@ -116,7 +115,7 @@ const ModalWrapper = compose( ...@@ -116,7 +115,7 @@ const ModalWrapper = compose(
)) ))
export default compose( export default compose(
connect(null, { inviteReviewer, revokeReviewer }), connect(null, { inviteReviewer, revokeReviewer, getCollectionReviewers }),
withModal2(props => ({ withModal2(props => ({
modalComponent: ModalWrapper, modalComponent: ModalWrapper,
})), })),
...@@ -145,6 +144,7 @@ export default compose( ...@@ -145,6 +144,7 @@ export default compose(
goBackToReviewers, goBackToReviewers,
inviteReviewer, inviteReviewer,
collectionId, collectionId,
getCollectionReviewers,
}) => reviewer => () => { }) => reviewer => () => {
showModal({ showModal({
title: 'Resend reviewer invite', title: 'Resend reviewer invite',
...@@ -153,7 +153,9 @@ export default compose( ...@@ -153,7 +153,9 @@ export default compose(
inviteReviewer( inviteReviewer(
pick(reviewer, ['email', 'firstName', 'lastName', 'affiliation']), pick(reviewer, ['email', 'firstName', 'lastName', 'affiliation']),
collectionId, collectionId,
).then(hideModal) )
.then(() => getCollectionReviewers(collectionId))
.then(hideModal)
}, },
onCancel: hideModal, onCancel: hideModal,
}) })
...@@ -165,12 +167,15 @@ export default compose( ...@@ -165,12 +167,15 @@ export default compose(
goBackToReviewers, goBackToReviewers,
revokeReviewer, revokeReviewer,
collectionId, collectionId,
getCollectionReviewers,
}) => invitationId => () => { }) => invitationId => () => {
showModal({ showModal({
title: 'Unassign Reviewer', title: 'Unassign Reviewer',
confirmText: 'Unassign', confirmText: 'Unassign',
onConfirm: () => { onConfirm: () => {
revokeReviewer(invitationId, collectionId).then(hideModal) revokeReviewer(invitationId, collectionId)
.then(() => getCollectionReviewers(collectionId))
.then(hideModal)
}, },
onCancel: hideModal, onCancel: hideModal,
}) })
......
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