Merge pull request #2813 from overleaf/ns-ta-group-account-admin

Add admin to group account when new group account is created

GitOrigin-RevId: 81c49a0b414896153a85a8ba1afc364164047c1c
This commit is contained in:
Jessica Lawshe 2020-05-06 09:58:29 -05:00 committed by Copybot
parent 43a88a0939
commit 4349e85444
2 changed files with 13 additions and 1 deletions

View file

@ -265,6 +265,10 @@ const SubscriptionUpdater = {
)
}
if (plan.groupPlan) {
if (!subscription.groupPlan) {
subscription.member_ids = subscription.member_ids || []
subscription.member_ids.push(subscription.admin_id)
}
subscription.groupPlan = true
subscription.membersLimit = plan.membersLimit
}

View file

@ -23,7 +23,7 @@ describe('SubscriptionUpdater', function() {
_id: '111111111111111111111111',
admin_id: this.adminUser._id,
manager_ids: [this.adminUser._id],
member_ids: this.allUserIds,
member_ids: [],
save: sinon.stub().callsArgWith(0),
planCode: 'student_or_something'
}
@ -241,6 +241,10 @@ describe('SubscriptionUpdater', function() {
this.SubscriptionUpdater.deleteSubscription = sinon.stub().yields()
})
afterEach(function() {
this.subscription.member_ids = []
})
it('should update the subscription with token etc when not expired', function(done) {
this.SubscriptionUpdater._updateSubscriptionFromRecurly(
this.recurlySubscription,
@ -284,6 +288,7 @@ describe('SubscriptionUpdater', function() {
})
it('should update all the users features', function(done) {
this.subscription.member_ids = this.allUserIds
this.SubscriptionUpdater._updateSubscriptionFromRecurly(
this.recurlySubscription,
this.subscription,
@ -323,6 +328,9 @@ describe('SubscriptionUpdater', function() {
}
this.subscription.membersLimit.should.equal(5)
this.subscription.groupPlan.should.equal(true)
this.subscription.member_ids.should.deep.equal([
this.subscription.admin_id
])
done()
}
)