diff --git a/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee b/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee index a28557e63a..e6a1736908 100644 --- a/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee +++ b/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee @@ -164,7 +164,9 @@ module.exports = SubscriptionController = SecurityManager.getCurrentUser req, (error, user) -> LimitationsManager.userHasSubscription user, (err, hasSubscription, subscription)-> planCode = subscription?.planCode.toLowerCase() - if planCode?.indexOf("student") != -1 + if planCode?.indexOf("annual") != -1 + planName = "annual" + else if planCode?.indexOf("student") != -1 planName = "student" else if planCode?.indexOf("collaborator") != -1 planName = "collaborator" diff --git a/services/web/public/coffee/main/annual-upgrade.coffee b/services/web/public/coffee/main/annual-upgrade.coffee index 37e0f6e87e..9e16c501f6 100644 --- a/services/web/public/coffee/main/annual-upgrade.coffee +++ b/services/web/public/coffee/main/annual-upgrade.coffee @@ -11,7 +11,8 @@ define [ collaborator:"36" $scope.$watch $scope.planName, -> $scope.yearlySaving = savings[$scope.planName] - + if $scope.planName == "annual" + $scope.upgradeComplete = true $scope.completeAnnualUpgrade = -> body = planName: $scope.planName diff --git a/services/web/test/UnitTests/coffee/Subscription/SubscriptionControllerTests.coffee b/services/web/test/UnitTests/coffee/Subscription/SubscriptionControllerTests.coffee index 1d4fbe4b31..208f35004d 100644 --- a/services/web/test/UnitTests/coffee/Subscription/SubscriptionControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Subscription/SubscriptionControllerTests.coffee @@ -323,6 +323,15 @@ describe "SubscriptionController sanboxed", -> done() @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", -> beforeEach ->