Plan UI lookup was using the *name* of the plan, not its data

This commit is contained in:
Joseph Schorr 2015-08-12 23:42:40 -04:00
parent 5ba3521e67
commit 932a85a8c9

View file

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