mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02: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:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user