mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-22 02:04:31 +00:00
Merge pull request #1865 from overleaf/ta-group-invite-self-view
Return User Data when Inviting Self in Group GitOrigin-RevId: 5aeb9f0b21b84184a612ed730ac08dcb1c434f6e
This commit is contained in:
parent
7e1b4195c5
commit
d189dad162
3 changed files with 20 additions and 8 deletions
|
@ -37,14 +37,11 @@ module.exports = {
|
|||
teamManagerId,
|
||||
subscription,
|
||||
email,
|
||||
function(err, invite) {
|
||||
function(err, inviteUserData) {
|
||||
if (err != null) {
|
||||
return next(err)
|
||||
}
|
||||
const inviteView = {
|
||||
user: { email: invite.email, sentAt: invite.sentAt, invite: true }
|
||||
}
|
||||
return res.json(inviteView)
|
||||
return res.json({ user: inviteUserData })
|
||||
}
|
||||
)
|
||||
},
|
||||
|
|
|
@ -161,7 +161,15 @@ var createInvite = function(subscription, email, inviter, callback) {
|
|||
}
|
||||
|
||||
// legacy: remove any invite that might have been created in the past
|
||||
removeInviteFromTeam(subscription._id, email, callback)
|
||||
removeInviteFromTeam(subscription._id, email, error => {
|
||||
const inviteUserData = {
|
||||
email: inviter.email,
|
||||
first_name: inviter.first_name,
|
||||
last_name: inviter.last_name,
|
||||
invite: false
|
||||
}
|
||||
callback(error, inviteUserData)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -194,9 +202,10 @@ var createInvite = function(subscription, email, inviter, callback) {
|
|||
}/`,
|
||||
appName: settings.appName
|
||||
}
|
||||
EmailHandler.sendEmail('verifyEmailToJoinTeam', opts, error =>
|
||||
EmailHandler.sendEmail('verifyEmailToJoinTeam', opts, error => {
|
||||
Object.assign(invite, { invite: true })
|
||||
callback(error, invite)
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ describe('TeamInvitesHandler', function() {
|
|||
expect(invite.inviterName).to.eq(
|
||||
'Daenerys Targaryen (daenerys@example.com)'
|
||||
)
|
||||
expect(invite.invite).to.be.true
|
||||
expect(this.subscription.teamInvites).to.deep.include(invite)
|
||||
done()
|
||||
}
|
||||
|
@ -220,6 +221,11 @@ describe('TeamInvitesHandler', function() {
|
|||
this.manager._id
|
||||
)
|
||||
sinon.assert.notCalled(this.subscription.save)
|
||||
expect(invite.token).to.not.exist
|
||||
expect(invite.email).to.eq(this.manager.email)
|
||||
expect(invite.first_name).to.eq(this.manager.first_name)
|
||||
expect(invite.last_name).to.eq(this.manager.last_name)
|
||||
expect(invite.invite).to.be.false
|
||||
done(err)
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue