Skip to content
Snippets Groups Projects
Commit 5477b591 authored by Sebastian's avatar Sebastian
Browse files

Merge branch 'master' of gitlab.coko.foundation:xpub/xpub-faraday

parents f2b6798a b1bc968a
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,7 @@ module.exports = models => async (req, res) => { ...@@ -49,7 +49,7 @@ module.exports = models => async (req, res) => {
'revoke-handling-editor', 'revoke-handling-editor',
) )
return res.status(204).json() return res.status(200).json({})
} catch (e) { } catch (e) {
logger.error(e.message) logger.error(e.message)
return res.status(500).json({ error: 'Email could not be sent.' }) return res.status(500).json({ error: 'Email could not be sent.' })
......
...@@ -5,6 +5,7 @@ import { get } from 'lodash' ...@@ -5,6 +5,7 @@ import { get } from 'lodash'
import { compose } from 'recompose' import { compose } from 'recompose'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { th, Icon } from '@pubsweet/ui' import { th, Icon } from '@pubsweet/ui'
import { actions } from 'pubsweet-client'
import styled, { withTheme } from 'styled-components' import styled, { withTheme } from 'styled-components'
import { handlingEditors, assignHandlingEditor } from '../../redux/editors' import { handlingEditors, assignHandlingEditor } from '../../redux/editors'
...@@ -34,14 +35,22 @@ class AssignHEModal extends React.Component { ...@@ -34,14 +35,22 @@ class AssignHEModal extends React.Component {
showModal, showModal,
hideModal, hideModal,
setModalError, setModalError,
updateCollection,
getCollections,
} = this.props } = this.props
assignHandlingEditor(email, collectionId).then( assignHandlingEditor(email, collectionId).then(
() => { () => {
hideModal() updateCollection({
showModal({ id: collectionId,
type: 'confirmation', status: 'he-invited',
title: 'Assignation Sent', }).then(() => {
cancelText: 'OK', getCollections()
hideModal()
showModal({
type: 'confirmation',
title: 'Assignation Sent',
cancelText: 'OK',
})
}) })
}, },
e => { e => {
...@@ -103,7 +112,11 @@ export default compose( ...@@ -103,7 +112,11 @@ export default compose(
state => ({ state => ({
editors: handlingEditors(state), editors: handlingEditors(state),
}), }),
{ assignHandlingEditor }, {
assignHandlingEditor,
updateCollection: actions.updateCollection,
getCollections: actions.getCollections,
},
), ),
withTheme, withTheme,
)(AssignHEModal) )(AssignHEModal)
......
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
} from 'pubsweet-component-modal/src/components' } from 'pubsweet-component-modal/src/components'
import ZipFiles from './ZipFiles' import ZipFiles from './ZipFiles'
import { parseVersion, parseJournalIssue } from './utils' import { parseVersion, parseJournalIssue, mapStatusToLabel } from './utils'
import HandlingEditorActions from './HandlingEditorActions' import HandlingEditorActions from './HandlingEditorActions'
const DashboardCard = ({ const DashboardCard = ({
...@@ -71,7 +71,7 @@ const DashboardCard = ({ ...@@ -71,7 +71,7 @@ const DashboardCard = ({
</Top> </Top>
<Bottom> <Bottom>
<LeftDetails flex="2"> <LeftDetails flex="2">
<Status>{status}</Status> <Status>{mapStatusToLabel(status)}</Status>
<DateField>{submitted || ''}</DateField> <DateField>{submitted || ''}</DateField>
</LeftDetails> </LeftDetails>
<RightDetails flex="5"> <RightDetails flex="5">
......
import React from 'react' import React from 'react'
import { get, head } from 'lodash' import { get, head } from 'lodash'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { actions } from 'pubsweet-client'
import { Icon, Button, th } from '@pubsweet/ui' import { Icon, Button, th } from '@pubsweet/ui'
import { compose, withHandlers } from 'recompose' import { compose, withHandlers } from 'recompose'
import styled, { css, withTheme } from 'styled-components' import styled, { css, withTheme } from 'styled-components'
...@@ -64,7 +65,12 @@ const handleError = fn => e => { ...@@ -64,7 +65,12 @@ const handleError = fn => e => {
} }
export default compose( export default compose(
connect(null, { revokeHandlingEditor, assignHandlingEditor }), connect(null, {
revokeHandlingEditor,
assignHandlingEditor,
updateCollection: actions.updateCollection,
getCollections: actions.getCollections,
}),
withTheme, withTheme,
withModal({ withModal({
modalKey: 'confirmHE', modalKey: 'confirmHE',
...@@ -93,6 +99,8 @@ export default compose( ...@@ -93,6 +99,8 @@ export default compose(
getHandlingEditor, getHandlingEditor,
hideModal, hideModal,
setModalError, setModalError,
updateCollection,
getCollections,
}) => actionType => { }) => actionType => {
const editor = getHandlingEditor() const editor = getHandlingEditor()
const resendConfig = { const resendConfig = {
...@@ -117,10 +125,16 @@ export default compose( ...@@ -117,10 +125,16 @@ export default compose(
confirmText: 'Revoke invite', confirmText: 'Revoke invite',
onConfirm: () => onConfirm: () =>
revokeHandlingEditor(get(editor, 'id'), project.id).then(() => { revokeHandlingEditor(get(editor, 'id'), project.id).then(() => {
hideModal() updateCollection({
showModal({ id: project.id,
type: 'success', status: 'submitted',
title: 'Handling Editor Assignation Revoked', }).then(() => {
getCollections()
hideModal()
showModal({
type: 'success',
title: 'Handling Editor Assignation Revoked',
})
}) })
}, handleError(setModalError)), }, handleError(setModalError)),
} }
......
...@@ -74,3 +74,12 @@ export const parseVersion = version => ({ ...@@ -74,3 +74,12 @@ export const parseVersion = version => ({
export const parseJournalIssue = (journal, metadata) => export const parseJournalIssue = (journal, metadata) =>
journal.issueTypes.find(t => t.value === get(metadata, 'issue')) journal.issueTypes.find(t => t.value === get(metadata, 'issue'))
export const mapStatusToLabel = status => {
switch (status) {
case 'he-invited':
return 'HE Invited'
default:
return 'Submitted'
}
}
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