From 932a85a8c9cb413c7f28bbefa2482966462180c7 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 12 Aug 2015 23:42:40 -0400 Subject: [PATCH] Plan UI lookup was using the *name* of the plan, not its data --- static/js/directives/ui/plan-manager.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/static/js/directives/ui/plan-manager.js b/static/js/directives/ui/plan-manager.js index f250c6127..c6414378e 100644 --- a/static/js/directives/ui/plan-manager.js +++ b/static/js/directives/ui/plan-manager.js @@ -25,18 +25,19 @@ angular.module('quay').directive('planManager', function () { }; $scope.isPlanVisible = function(plan, subscribedPlan) { + if ($scope.organization && !PlanService.isOrgCompatible(plan)) { + return false; + } + // A plan is visible if it is not deprecated, or if it is both not superseded // by another plan, and also the active plan for the user. if (plan['deprecated']) { - superseded = plan['superseded_by'] + var superseded = PlanService.getPlanImmediately(plan['superseded_by']); if (superseded) { return !$scope.isPlanVisible(superseded, subscribedPlan); } - return plan == subscribedPlan; - } - if ($scope.organization && !PlanService.isOrgCompatible(plan)) { - return false; + return plan.stripeId === subscribedPlan.stripeId; } return true; @@ -53,7 +54,7 @@ angular.module('quay').directive('planManager', function () { return $scope.isPlanActive(plan, PlanService.getPlanImmediately(subscribedPlan['superseded_by'])); } - return (plan.stripeId === subscribedPlan.stripeId); + return plan.stripeId === subscribedPlan.stripeId; }; $scope.changeSubscription = function(planId, opt_async) {