mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 05:50:35 +03:00
Removed invite before adding in v2
refs #9866 - the logic in v2 was missing - it exists in v0.1
This commit is contained in:
parent
b1c7781cc6
commit
14a1bdbcf6
@ -107,7 +107,18 @@ module.exports = {
|
||||
let invite;
|
||||
let emailData;
|
||||
|
||||
return models.Invite.add(frame.data.invites[0], frame.options)
|
||||
// CASE: ensure we destroy the invite before
|
||||
return models.Invite.findOne({email: frame.data.invites[0].email}, frame.options)
|
||||
.then((invite) => {
|
||||
if (!invite) {
|
||||
return;
|
||||
}
|
||||
|
||||
return invite.destroy(frame.options);
|
||||
})
|
||||
.then(() => {
|
||||
return models.Invite.add(frame.data.invites[0], frame.options);
|
||||
})
|
||||
.then((_invite) => {
|
||||
invite = _invite;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user