mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
if user is already annual tell them so on the annual upgrade page
This commit is contained in:
parent
cffcdbae18
commit
e740e4913d
3 changed files with 14 additions and 2 deletions
|
@ -164,7 +164,9 @@ module.exports = SubscriptionController =
|
||||||
SecurityManager.getCurrentUser req, (error, user) ->
|
SecurityManager.getCurrentUser req, (error, user) ->
|
||||||
LimitationsManager.userHasSubscription user, (err, hasSubscription, subscription)->
|
LimitationsManager.userHasSubscription user, (err, hasSubscription, subscription)->
|
||||||
planCode = subscription?.planCode.toLowerCase()
|
planCode = subscription?.planCode.toLowerCase()
|
||||||
if planCode?.indexOf("student") != -1
|
if planCode?.indexOf("annual") != -1
|
||||||
|
planName = "annual"
|
||||||
|
else if planCode?.indexOf("student") != -1
|
||||||
planName = "student"
|
planName = "student"
|
||||||
else if planCode?.indexOf("collaborator") != -1
|
else if planCode?.indexOf("collaborator") != -1
|
||||||
planName = "collaborator"
|
planName = "collaborator"
|
||||||
|
|
|
@ -11,7 +11,8 @@ define [
|
||||||
collaborator:"36"
|
collaborator:"36"
|
||||||
$scope.$watch $scope.planName, ->
|
$scope.$watch $scope.planName, ->
|
||||||
$scope.yearlySaving = savings[$scope.planName]
|
$scope.yearlySaving = savings[$scope.planName]
|
||||||
|
if $scope.planName == "annual"
|
||||||
|
$scope.upgradeComplete = true
|
||||||
$scope.completeAnnualUpgrade = ->
|
$scope.completeAnnualUpgrade = ->
|
||||||
body =
|
body =
|
||||||
planName: $scope.planName
|
planName: $scope.planName
|
||||||
|
|
|
@ -323,6 +323,15 @@ describe "SubscriptionController sanboxed", ->
|
||||||
done()
|
done()
|
||||||
@SubscriptionController.renderUpgradeToAnnualPlanPage @req, @res
|
@SubscriptionController.renderUpgradeToAnnualPlanPage @req, @res
|
||||||
|
|
||||||
|
it "should pass annual as the plan name if the user is already on an annual plan", (done)->
|
||||||
|
|
||||||
|
@LimitationsManager.userHasSubscription.callsArgWith(1, null, true, {planCode:"student annual with free trial"})
|
||||||
|
@res.render = (view, opts)->
|
||||||
|
opts.planName.should.equal "annual"
|
||||||
|
done()
|
||||||
|
@SubscriptionController.renderUpgradeToAnnualPlanPage @req, @res
|
||||||
|
|
||||||
|
|
||||||
describe "processUpgradeToAnnualPlan", ->
|
describe "processUpgradeToAnnualPlan", ->
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
Loading…
Reference in a new issue