diff --git a/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee b/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee index 1cac328d4b..c34b6c028d 100644 --- a/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee +++ b/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee @@ -43,6 +43,11 @@ module.exports = LimitationsManager = logger.log {user_id:user._id, isMember, hasSubscription, hasV1Subscription}, "checking if user has subscription or is group member" callback err, isMember or hasSubscription or hasV1Subscription, subscription + + # alias for backward-compatibility with modules. Use `haspaidsubscription` instead + userHasSubscriptionOrIsGroupMember: (user, callback) -> + @hasPaidSubscription(user, callback) + userHasV2Subscription: (user, callback = (err, hasSubscription, subscription)->) -> logger.log user_id:user._id, "checking if user has subscription" SubscriptionLocator.getUsersSubscription user._id, (err, subscription)-> diff --git a/services/web/test/unit/coffee/Subscription/LimitationsManagerTests.coffee b/services/web/test/unit/coffee/Subscription/LimitationsManagerTests.coffee index 57231d9f38..e872930500 100644 --- a/services/web/test/unit/coffee/Subscription/LimitationsManagerTests.coffee +++ b/services/web/test/unit/coffee/Subscription/LimitationsManagerTests.coffee @@ -277,6 +277,11 @@ describe "LimitationsManager", -> hasSubOrIsGroupMember.should.equal false done() + it "should have userHasSubscriptionOrIsGroupMember alias", (done)-> + @LimitationsManager.userHasSubscriptionOrIsGroupMember @user, (err, hasSubOrIsGroupMember)-> + hasSubOrIsGroupMember.should.equal false + done() + describe "userHasV1OrV2Subscription", -> beforeEach -> @LimitationsManager.userHasV2Subscription = sinon.stub().yields(null, false)