mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 18:51:11 +00:00
Merge pull request #715 from sharelatex/afc-multiple-managers
Store team managers in an array
This commit is contained in:
commit
2d43de20bf
3 changed files with 6 additions and 1 deletions
|
@ -71,7 +71,7 @@ module.exports = SubscriptionUpdater =
|
|||
|
||||
_createNewSubscription: (adminUser_id, callback)->
|
||||
logger.log adminUser_id:adminUser_id, "creating new subscription"
|
||||
subscription = new Subscription(admin_id:adminUser_id)
|
||||
subscription = new Subscription(admin_id:adminUser_id, manager_ids: [adminUser_id])
|
||||
subscription.freeTrial.allowed = false
|
||||
subscription.save (err)->
|
||||
callback err, subscription
|
||||
|
|
|
@ -7,6 +7,7 @@ ObjectId = Schema.ObjectId
|
|||
|
||||
SubscriptionSchema = new Schema
|
||||
admin_id : {type:ObjectId, ref:'User', index: {unique: true, dropDups: true}}
|
||||
manager_ids : [ type:ObjectId, ref:'User' ]
|
||||
member_ids : [ type:ObjectId, ref:'User' ]
|
||||
invited_emails: [ String ]
|
||||
teamInvites : [ TeamInviteSchema ]
|
||||
|
|
|
@ -20,6 +20,7 @@ describe "SubscriptionUpdater", ->
|
|||
@subscription = subscription =
|
||||
_id: "111111111111111111111111"
|
||||
admin_id: @adminUser._id
|
||||
manager_ids: [@adminUser._id]
|
||||
member_ids: @allUserIds
|
||||
save: sinon.stub().callsArgWith(0)
|
||||
freeTrial:{}
|
||||
|
@ -29,6 +30,7 @@ describe "SubscriptionUpdater", ->
|
|||
@groupSubscription =
|
||||
_id: "222222222222222222222222"
|
||||
admin_id: @adminUser._id
|
||||
manager_ids: [@adminUser._id]
|
||||
member_ids: @allUserIds
|
||||
save: sinon.stub().callsArgWith(0)
|
||||
freeTrial:{}
|
||||
|
@ -40,6 +42,7 @@ describe "SubscriptionUpdater", ->
|
|||
@SubscriptionModel = class
|
||||
constructor: (opts)->
|
||||
subscription.admin_id = opts.admin_id
|
||||
subscription.manager_ids = [opts.admin_id]
|
||||
return subscription
|
||||
@remove: sinon.stub().yields()
|
||||
@SubscriptionModel.update = @updateStub
|
||||
|
@ -151,6 +154,7 @@ describe "SubscriptionUpdater", ->
|
|||
it "should create a new subscription then update the subscription", (done)->
|
||||
@SubscriptionUpdater._createNewSubscription @adminUser._id, =>
|
||||
@subscription.admin_id.should.equal @adminUser._id
|
||||
@subscription.manager_ids.should.deep.equal [@adminUser._id]
|
||||
@subscription.freeTrial.allowed.should.equal false
|
||||
@subscription.save.called.should.equal true
|
||||
done()
|
||||
|
|
Loading…
Reference in a new issue