Bladeren bron

Merge pull request #762 from sharelatex/afc-fix-domain-team-invites

Fix domain licences invites
Alberto Fernández-Capel 8 jaren geleden
bovenliggende
commit
85999bbbec

+ 1 - 1
services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee

@@ -76,7 +76,7 @@ module.exports = TeamInvitesHandler =
 			return callback(err) if err?
 			return callback(err) if err?
 			return callback(new Errors.NotFoundError('invite not found')) unless invite?
 			return callback(new Errors.NotFoundError('invite not found')) unless invite?
 
 
-			SubscriptionUpdater.addUserToGroup subscription.admin_id, userId, (err) ->
+			SubscriptionUpdater.addUserToGroup subscription._id, userId, (err) ->
 				return callback(err) if err?
 				return callback(err) if err?
 
 
 				removeInviteFromTeam(subscription.id, invite.email, callback)
 				removeInviteFromTeam(subscription.id, invite.email, callback)

+ 2 - 2
services/web/test/unit/coffee/Subscription/SubscriptionGroupHandlerTests.coffee

@@ -88,8 +88,8 @@ describe "SubscriptionGroupHandler", ->
 				done()
 				done()
 
 
 		it "should add the user to the group", (done)->
 		it "should add the user to the group", (done)->
-			@Handler.addUserToGroup @adminUser_id, @newEmail, (err)=>
-				@SubscriptionUpdater.addUserToGroup.calledWith(@adminUser_id, @user._id).should.equal true
+			@Handler.addUserToGroup @subscription_id, @newEmail, (err)=>
+				@SubscriptionUpdater.addUserToGroup.calledWith(@subscription_id, @user._id).should.equal true
 				done()
 				done()
 
 
 		it "should not add the user to the group if the limit has been reached", (done)->
 		it "should not add the user to the group if the limit has been reached", (done)->

+ 2 - 1
services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee

@@ -26,6 +26,7 @@ describe "TeamInvitesHandler", ->
 
 
 		@subscription = {
 		@subscription = {
 			id: "55153a8014829a865bbf700d",
 			id: "55153a8014829a865bbf700d",
+			_id: new ObjectId("55153a8014829a865bbf700d"),
 			admin_id: @manager.id,
 			admin_id: @manager.id,
 			groupPlan: true,
 			groupPlan: true,
 			member_ids: [],
 			member_ids: [],
@@ -210,7 +211,7 @@ describe "TeamInvitesHandler", ->
 
 
 		it "adds the user to the team", (done) ->
 		it "adds the user to the team", (done) ->
 			@TeamInvitesHandler.acceptInvite "dddddddd", @user.id, =>
 			@TeamInvitesHandler.acceptInvite "dddddddd", @user.id, =>
-				@SubscriptionUpdater.addUserToGroup.calledWith(@manager.id, @user.id).should.eq true
+				@SubscriptionUpdater.addUserToGroup.calledWith(@subscription._id, @user.id).should.eq true
 				done()
 				done()
 
 
 		it "removes the invite from the subscription", (done) ->
 		it "removes the invite from the subscription", (done) ->