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)->
|
SubscriptionLocator.getUsersSubscription user._id, (err, subscription)->
|
||||||
if err?
|
if err?
|
||||||
return callback(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"
|
logger.log user:user, hasValidSubscription:hasValidSubscription, subscription:subscription, "checking if user has subscription"
|
||||||
callback err, hasValidSubscription, subscription
|
callback err, hasValidSubscription, subscription
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,22 @@ describe "LimitationsManager", ->
|
||||||
subscription.should.deep.equal stubbedSubscription
|
subscription.should.deep.equal stubbedSubscription
|
||||||
done()
|
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", ->
|
describe "userIsMemberOfGroupSubscription", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@SubscriptionLocator.getMemberSubscriptions = sinon.stub()
|
@SubscriptionLocator.getMemberSubscriptions = sinon.stub()
|
||||||
|
|
Loading…
Reference in a new issue