Skip to content
Snippets Groups Projects
Commit aae9ef67 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

Merge branch 'refactor-component-invite' of...

Merge branch 'refactor-component-invite' of gitlab.coko.foundation:xpub/xpub-faraday into refactor-component-invite
parents a5b222f9 2a2637c6
No related branches found
No related tags found
1 merge request!5Refactor component invite
...@@ -32,7 +32,9 @@ module.exports = models => async (req, res) => { ...@@ -32,7 +32,9 @@ module.exports = models => async (req, res) => {
collection.invitations = collection.invitations.filter( collection.invitations = collection.invitations.filter(
inv => inv.id !== invitation.id, inv => inv.id !== invitation.id,
) )
if (invitation.role === 'handlingEditor') {
delete collection.handlingEditor
}
await collection.save() await collection.save()
await teamHelper.removeTeamMember(team.id, invitation.userId, models.Team) await teamHelper.removeTeamMember(team.id, invitation.userId, models.Team)
const user = await models.User.find(invitation.userId) const user = await models.User.find(invitation.userId)
......
...@@ -34,9 +34,10 @@ module.exports = models => async (req, res) => { ...@@ -34,9 +34,10 @@ module.exports = models => async (req, res) => {
error: 'Collection and user do not match', error: 'Collection and user do not match',
}) })
} }
matchingAuthor.firstName = firstName user.firstName = firstName
matchingAuthor.lastName = lastName user.lastName = lastName
matchingAuthor.affiliation = affiliation user.affiliation = affiliation
await user.save()
matchingAuthor.isSubmitting = isSubmitting matchingAuthor.isSubmitting = isSubmitting
matchingAuthor.isCorresponding = isCorresponding matchingAuthor.isCorresponding = isCorresponding
collection = await collection.save() collection = await collection.save()
......
...@@ -42,7 +42,8 @@ describe('Patch collections users route handler', () => { ...@@ -42,7 +42,8 @@ describe('Patch collections users route handler', () => {
) )
expect(matchingAuthor.isSubmitting).toBe(body.isSubmitting) expect(matchingAuthor.isSubmitting).toBe(body.isSubmitting)
expect(matchingAuthor.isCorresponding).toBe(body.isCorresponding) expect(matchingAuthor.isCorresponding).toBe(body.isCorresponding)
expect(matchingAuthor.firstName).toBe(body.firstName) expect(submittingAuthor.firstName).toBe(body.firstName)
expect(submittingAuthor.lastName).toBe(body.lastName)
}) })
it('should return an error when the params are missing', async () => { it('should return an error when the params are missing', async () => {
delete body.isSubmitting delete body.isSubmitting
......
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