From 66b492ba5f25ab3f4e1c2a989bd23ffbb2564e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Fern=C3=A1ndez=20Capel?= Date: Mon, 16 Jul 2018 14:42:37 +0100 Subject: [PATCH] Use id to find subscription It's the new method signature. --- .../app/coffee/Features/Subscription/TeamInvitesHandler.coffee | 2 +- .../unit/coffee/Subscription/TeamInvitesHandlerTests.coffee | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee b/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee index c3b3b11089..7bbfd78780 100644 --- a/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee +++ b/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee @@ -76,7 +76,7 @@ module.exports = TeamInvitesHandler = return callback(err) if err? 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? removeInviteFromTeam(subscription.id, invite.email, callback) diff --git a/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee b/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee index d23d1fc3a6..e6f404516e 100644 --- a/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee +++ b/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee @@ -26,6 +26,7 @@ describe "TeamInvitesHandler", -> @subscription = { id: "55153a8014829a865bbf700d", + _id: new ObjectId("55153a8014829a865bbf700d"), admin_id: @manager.id, groupPlan: true, member_ids: [], @@ -210,7 +211,7 @@ describe "TeamInvitesHandler", -> it "adds the user to the team", (done) -> @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() it "removes the invite from the subscription", (done) ->