Merge pull request #15405 from overleaf/msm-remove-redundant-check

[web] Remove redundant check

GitOrigin-RevId: 035adf436c0d694fcb7817cd27e743683eb1252d
This commit is contained in:
Miguel Serrano 2023-10-31 13:15:24 +01:00 committed by Copybot
parent ce2222dcf7
commit 93b7e65f6c

View file

@ -157,9 +157,7 @@ async function _addInstitutionEmail(userId, email, providerId, auditLog) {
throw new Errors.NotFoundError('user not found')
}
const emailAlreadyAssociated = user.emails.find(e => e.email === email)
if (emailAlreadyAssociated && emailAlreadyAssociated.confirmedAt) {
await UserUpdater.promises.updateUser(query, update)
} else if (emailAlreadyAssociated) {
if (emailAlreadyAssociated) {
await UserUpdater.promises.updateUser(query, update)
} else {
await UserUpdater.promises.addEmailAddress(