mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 10:01:40 +00:00
Merge pull request #895 from sharelatex/ta-add-method-alias
add userHasSubscriptionOrIsGroupMember alias
This commit is contained in:
commit
9b37b0e66f
2 changed files with 10 additions and 0 deletions
|
@ -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)->
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue