diff --git a/packages/component-modal/src/components/SubmissionModal.js b/packages/component-modal/src/components/SubmissionModal.js index 62060fb6bfcc8c6024cded7bbe56c9c573967d3d..f092ac3c3257d89cb579847720c9ba95d824007a 100644 --- a/packages/component-modal/src/components/SubmissionModal.js +++ b/packages/component-modal/src/components/SubmissionModal.js @@ -22,7 +22,7 @@ const SubmissionModal = ({ <Title>{title}</Title> <Text> The corresponding author confirms that all co-authors are included, and - taht everyone listed as co-author agrees to that role and all the + that everyone listed as co-author agrees to that role and all the following requirements and acknowledgements. The submission represents original work and that sources are given proper attribution. </Text> diff --git a/packages/component-wizard/src/redux/conversion.js b/packages/component-wizard/src/redux/conversion.js index 5bdabda09510f9aca692a1d1ef864fd08c343ae2..94cb6eb3e8993b818c8125674fa4705bd724f926 100644 --- a/packages/component-wizard/src/redux/conversion.js +++ b/packages/component-wizard/src/redux/conversion.js @@ -23,16 +23,35 @@ export const isRevisionFlow = (state, collection, fragment = {}) => collection.fragments.length > 1 && !fragment.submitted /* actions */ -const addSubmittingAuthor = (user, collectionId, fragmentId) => { - const author = { - ...pick(user, ['id', 'email', 'affiliation', 'firstName', 'lastName']), - isSubmitting: true, - isCorresponding: true, +// const addSubmittingAuthor = (user, collectionId, fragmentId) => { +// const author = { +// ...pick(user, ['id', 'email', 'affiliation', 'firstName', 'lastName']), +// isSubmitting: true, +// isCorresponding: true, +// } +// create(`/collections/${collectionId}/fragments/${fragmentId}/users`, { +// role: 'author', +// ...author, +// }) +// } + +const getAuthors = currentUser => { + if (!currentUser.admin) { + return [ + { + ...pick(currentUser, [ + 'id', + 'email', + 'affiliation', + 'firstName', + 'lastName', + ]), + isSubmitting: true, + isCorresponding: true, + }, + ] } - create(`/collections/${collectionId}/fragments/${fragmentId}/users`, { - role: 'author', - ...author, - }) + return [] } export const createDraftSubmission = history => (dispatch, getState) => { @@ -48,6 +67,7 @@ export const createDraftSubmission = history => (dispatch, getState) => { return dispatch( actions.createFragment(collection, { created: new Date(), // TODO: set on server + authors: getAuthors(currentUser), collectionId: collection.id, files: { manuscripts: [], @@ -63,9 +83,9 @@ export const createDraftSubmission = history => (dispatch, getState) => { throw new Error('Failed to create a project') } const route = `/projects/${collection.id}/versions/${fragment.id}/submit` - if (!currentUser.admin) { - addSubmittingAuthor(currentUser, collection.id, fragment.id) - } + // if (!currentUser.admin) { + // addSubmittingAuthor(currentUser, collection.id, fragment.id) + // } // redirect after a short delay window.setTimeout(() => { diff --git a/packages/xpub-faraday/config/authsome-mode.js b/packages/xpub-faraday/config/authsome-mode.js index 2a6968bf43a6712f5d3e162f24ac136525242a0f..b30cc31d339fb640883bc0e0cd631453a0c512ea 100644 --- a/packages/xpub-faraday/config/authsome-mode.js +++ b/packages/xpub-faraday/config/authsome-mode.js @@ -96,12 +96,13 @@ async function applyAuthenticatedUserPolicy(user, operation, object, context) { user, Team: context.models.Team, }) - - const { role } = userPermissions.find( + // TODO: check why collPermission can be undefined + const collPermission = userPermissions.find( p => p.objectId === collection.id || collection.fragments.includes(p.objectId), ) + const role = get(collPermission, 'role', 'author') const visibleStatus = get(statuses, `${status}.${role}.label`) const parsedCollection = helpers.stripeCollectionByRole( collection,