Skip to content
Snippets Groups Projects
Commit 248546b3 authored by Sebastian's avatar Sebastian
Browse files

feat(component-invite): fix invitation setup

parent fd5d9f93
No related branches found
No related tags found
1 merge request!5Refactor component invite
......@@ -46,7 +46,7 @@ module.exports = models => async (req, res) => {
await teamHelper.setupManuscriptTeam(models, user, collectionId, role)
// find if there already is a matching invitation in the collection
await collectionHelper.addInvitation(collection)
await collectionHelper.addInvitation(collection, user.id, role)
try {
await mailService.setupAssignEmail(
......
......@@ -70,6 +70,10 @@ describe('Post collections invitations route handler', () => {
expect(standardCollection.invitations.length).toBeGreaterThan(initialSize)
expect(heTeam.members).toContain(author.id)
expect(author.teams).toContain(heTeam.id)
const matchingInvitation = standardCollection.invitations.find(
inv => inv.userId === author.id && inv.role === body.role,
)
expect(matchingInvitation).toBeDefined()
})
it('should return an error when inviting his self', async () => {
body.role = roles[random(0, roles.length - 1)]
......
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