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) {