mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Don’t show upgrade prompts for users with custom subscription accounts.
Set `hasValidSubscription` to true if user subscription is custom.
This commit is contained in:
parent
62a444082d
commit
effc3727be
2 changed files with 18 additions and 2 deletions
|
@ -38,7 +38,7 @@ module.exports =
|
|||
SubscriptionLocator.getUsersSubscription user._id, (err, subscription)->
|
||||
if err?
|
||||
return callback(err)
|
||||
hasValidSubscription = subscription? and subscription.recurlySubscription_id?
|
||||
hasValidSubscription = subscription? and (subscription.recurlySubscription_id? or subscription.customAccount?)
|
||||
logger.log user:user, hasValidSubscription:hasValidSubscription, subscription:subscription, "checking if user has subscription"
|
||||
callback err, hasValidSubscription, subscription
|
||||
|
||||
|
|
|
@ -127,7 +127,23 @@ describe "LimitationsManager", ->
|
|||
@LimitationsManager.userHasSubscription @user, (err, hasSubOrIsGroupMember, subscription)->
|
||||
subscription.should.deep.equal stubbedSubscription
|
||||
done()
|
||||
|
||||
|
||||
describe "when user has a custom account", ->
|
||||
|
||||
beforeEach ->
|
||||
@fakeSubscription = {customAccount: true}
|
||||
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, @fakeSubscription)
|
||||
|
||||
it 'should return true', (done) ->
|
||||
@LimitationsManager.userHasSubscription @user, (err, hasSubscription, subscription)->
|
||||
hasSubscription.should.equal true
|
||||
done()
|
||||
|
||||
it 'should return the subscription', (done) ->
|
||||
@LimitationsManager.userHasSubscription @user, (err, hasSubscription, subscription)=>
|
||||
subscription.should.deep.equal @fakeSubscription
|
||||
done()
|
||||
|
||||
describe "userIsMemberOfGroupSubscription", ->
|
||||
beforeEach ->
|
||||
@SubscriptionLocator.getMemberSubscriptions = sinon.stub()
|
||||
|
|
Loading…
Reference in a new issue