diff --git a/services/web/app/coffee/Features/Subscription/SubscriptionUpdater.coffee b/services/web/app/coffee/Features/Subscription/SubscriptionUpdater.coffee index f4cdfcf86d..22e2c00987 100644 --- a/services/web/app/coffee/Features/Subscription/SubscriptionUpdater.coffee +++ b/services/web/app/coffee/Features/Subscription/SubscriptionUpdater.coffee @@ -29,13 +29,7 @@ module.exports = SubscriptionUpdater = @addUsersToGroup(subscriptionId, [userId], callback) addUsersToGroup: (subscriptionId, memberIds, callback)-> - logger.log subscriptionId: subscriptionId, memberIds: memberIds, "adding members into mongo subscription" - searchOps = - _id: subscriptionId - insertOperation = - { $addToSet: { member_ids: { $each: memberIds } } } - - Subscription.findAndModify searchOps, insertOperation, (err, subscription) -> + @addUsersToGroupWithoutFeaturesRefresh subscriptionId, memberIds, (err) -> return callback(err) if err? # Only apply features updates to users, not user stubs @@ -45,6 +39,14 @@ module.exports = SubscriptionUpdater = userIds = users.map (u) -> u._id.toString() async.map userIds, FeaturesUpdater.refreshFeatures, callback + addUsersToGroupWithoutFeaturesRefresh: (subscriptionId, memberIds, callback)-> + logger.log subscriptionId: subscriptionId, memberIds: memberIds, "adding members into mongo subscription" + searchOps = + _id: subscriptionId + insertOperation = + { $addToSet: { member_ids: { $each: memberIds } } } + + Subscription.findAndModify searchOps, insertOperation, callback removeUserFromGroup: (subscriptionId, user_id, callback)-> searchOps =