mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-21 13:24:21 +00:00
Merge pull request #8290 from overleaf/ta-redundant-subscription-saml
Don't Create Redundant Subscription Notification on SAML for Group Plans GitOrigin-RevId: 99e66201c9423ff7e849b2d68d96651ad6015fd0
This commit is contained in:
parent
1fe424631f
commit
b26c491eb5
2 changed files with 30 additions and 2 deletions
|
@ -226,7 +226,7 @@ async function redundantSubscription(userId, providerId, providerName) {
|
|||
const subscription =
|
||||
await SubscriptionLocator.promises.getUserIndividualSubscription(userId)
|
||||
|
||||
if (subscription) {
|
||||
if (subscription && !subscription.groupPlan) {
|
||||
await NotificationsBuilder.promises
|
||||
.redundantPersonalSubscription(
|
||||
{
|
||||
|
|
|
@ -536,6 +536,7 @@ describe('SAMLIdentityManager', function () {
|
|||
const userId = '1bv'
|
||||
const providerId = 123
|
||||
const providerName = 'University Name'
|
||||
|
||||
describe('with a personal subscription', function () {
|
||||
beforeEach(function () {
|
||||
this.SubscriptionLocator.promises.getUserIndividualSubscription.resolves(
|
||||
|
@ -544,6 +545,7 @@ describe('SAMLIdentityManager', function () {
|
|||
}
|
||||
)
|
||||
})
|
||||
|
||||
it('should create redundant personal subscription notification ', async function () {
|
||||
try {
|
||||
await this.SAMLIdentityManager.redundantSubscription(
|
||||
|
@ -558,7 +560,17 @@ describe('SAMLIdentityManager', function () {
|
|||
.to.have.been.calledOnce
|
||||
})
|
||||
})
|
||||
describe('without a personal subscription', function () {
|
||||
|
||||
describe('with a group subscription', function () {
|
||||
beforeEach(function () {
|
||||
this.SubscriptionLocator.promises.getUserIndividualSubscription.resolves(
|
||||
{
|
||||
planCode: 'professional',
|
||||
groupPlan: true,
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it('should create redundant personal subscription notification ', async function () {
|
||||
try {
|
||||
await this.SAMLIdentityManager.redundantSubscription(
|
||||
|
@ -573,5 +585,21 @@ describe('SAMLIdentityManager', function () {
|
|||
.to.not.have.been.called
|
||||
})
|
||||
})
|
||||
|
||||
describe('without a personal subscription', function () {
|
||||
it('should not create redundant personal subscription notification ', async function () {
|
||||
try {
|
||||
await this.SAMLIdentityManager.redundantSubscription(
|
||||
userId,
|
||||
providerId,
|
||||
providerName
|
||||
)
|
||||
} catch (error) {
|
||||
expect(error).to.not.exist
|
||||
}
|
||||
expect(this.NotificationsBuilder.promises.redundantPersonalSubscription)
|
||||
.to.not.have.been.called
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue