diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js index 8b683eda9911688c45e3fedafcf0163473c69e68..db6ee1a0981b71a520e57c8f2b7c9437cc4873d9 100644 --- a/packages/component-faraday-selectors/src/index.js +++ b/packages/component-faraday-selectors/src/index.js @@ -7,7 +7,7 @@ export const isHEToManuscript = (state, collectionId) => { return get(collection, 'handlingEditor.id') === currentUserId } -export const canMakeRecommendation = (state, collection, fragment) => { +export const canMakeRecommendation = (state, collection, fragment = {}) => { if (fragment.id !== last(collection.fragments)) return false const isHE = isHEToManuscript(state, collection.id) return isHE && get(collection, 'status') === 'reviewCompleted' @@ -58,7 +58,7 @@ export const getHERecommendation = (state, collectionId, fragmentId) => { } const cantMakeDecisionStatuses = ['rejected', 'published', 'draft'] -export const canMakeDecision = (state, collection, fragment) => { +export const canMakeDecision = (state, collection, fragment = {}) => { if (fragment.id !== last(collection.fragments)) return false const status = get(collection, 'status') diff --git a/packages/components-faraday/src/components/Admin/utils.js b/packages/components-faraday/src/components/Admin/utils.js index 99ea13817d8fe002597127d1a0d315c739482ec9..3d0dae705dbaa72f75de7b9e9b4cca96c02c0569 100644 --- a/packages/components-faraday/src/components/Admin/utils.js +++ b/packages/components-faraday/src/components/Admin/utils.js @@ -35,6 +35,12 @@ export const setAdmin = values => { } export const parseUpdateUser = values => { + const parsedValues = { + ...values, + editorInChief: values.editorInChief || false, + handlingEditor: values.handlingEditor || false, + admin: values.admin || false, + } const valuesToSave = [ 'admin', 'firstName', @@ -48,7 +54,7 @@ export const parseUpdateUser = values => { 'username', ] - return pick(values, valuesToSave) + return pick(parsedValues, valuesToSave) } export const handleFormError = error => { @@ -71,7 +77,6 @@ const toggleUserStatus = user => { newState = false newUsername = `invalid***${username}` } else { - newState = true newUsername = replace(username, 'invalid***', '') }