mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #8422 from overleaf/ta-silent-error
Silence Error If AffiliationUnchecked Flag Cannot Be Unset GitOrigin-RevId: 1e0ffc401dfcc1ac9ae1a3d1de850ab899b4ce8e
This commit is contained in:
parent
ff6c88de0c
commit
c30ec5fa7c
2 changed files with 17 additions and 7 deletions
|
@ -371,13 +371,15 @@ async function addAffiliationForNewUser(
|
|||
{ $unset: { 'emails.$.affiliationUnchecked': 1 } }
|
||||
)
|
||||
} catch (error) {
|
||||
throw OError.tag(
|
||||
error,
|
||||
'could not remove affiliationUnchecked flag for user on create',
|
||||
{
|
||||
userId,
|
||||
email,
|
||||
}
|
||||
logger.error(
|
||||
OError.tag(
|
||||
error,
|
||||
'could not remove affiliationUnchecked flag for user on create',
|
||||
{
|
||||
userId,
|
||||
email,
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,6 +160,14 @@ describe('UserUpdater', function () {
|
|||
{ $unset: { 'emails.$.affiliationUnchecked': 1 } }
|
||||
)
|
||||
})
|
||||
|
||||
it('should not throw if removing affiliationUnchecked flag errors', async function () {
|
||||
this.db.users.updateOne.rejects(new Error('nope'))
|
||||
await this.UserUpdater.promises.addAffiliationForNewUser(
|
||||
this.user._id,
|
||||
this.newEmail
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('changeEmailAddress', function () {
|
||||
|
|
Loading…
Reference in a new issue