mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-09 12:35:51 +00:00
Merge pull request #8363 from overleaf/jel-affiliation-check
[web] Handle when no affiliation found for redundant subscription check GitOrigin-RevId: c0e653b944b994c5eafaa2d4f2d54f3cb57d67fa
This commit is contained in:
parent
343cfe4f06
commit
7794e03dcb
2 changed files with 13 additions and 1 deletions
|
@ -295,7 +295,7 @@ async function maybeCreateRedundantSubscriptionNotification(userId, email) {
|
|||
userId
|
||||
)
|
||||
const confirmedAffiliation = affiliations.find(a => a.email === email)
|
||||
if (confirmedAffiliation.licence === 'free') {
|
||||
if (!confirmedAffiliation || confirmedAffiliation.licence === 'free') {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -928,6 +928,18 @@ describe('UserUpdater', function () {
|
|||
)
|
||||
})
|
||||
|
||||
it('should not call redundantPersonalSubscription when user is not on a commons license', async function () {
|
||||
this.InstitutionsAPI.promises.getUserAffiliations.resolves([])
|
||||
this.SubscriptionLocator.promises.getUserIndividualSubscription.resolves({
|
||||
planCode: 'personal',
|
||||
groupPlan: false,
|
||||
})
|
||||
await this.UserUpdater.promises.confirmEmail(this.user._id, this.newEmail)
|
||||
sinon.assert.notCalled(
|
||||
this.NotificationsBuilder.promises.redundantPersonalSubscription
|
||||
)
|
||||
})
|
||||
|
||||
describe('with institution licence and subscription', function () {
|
||||
beforeEach(async function () {
|
||||
this.affiliation = {
|
||||
|
|
Loading…
Add table
Reference in a new issue