Plan UI lookup was using the *name* of the plan, not its data
This commit is contained in:
parent
5ba3521e67
commit
932a85a8c9
1 changed files with 7 additions and 6 deletions
|
@ -25,18 +25,19 @@ angular.module('quay').directive('planManager', function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isPlanVisible = function(plan, subscribedPlan) {
|
$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
|
// 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.
|
// by another plan, and also the active plan for the user.
|
||||||
if (plan['deprecated']) {
|
if (plan['deprecated']) {
|
||||||
superseded = plan['superseded_by']
|
var superseded = PlanService.getPlanImmediately(plan['superseded_by']);
|
||||||
if (superseded) {
|
if (superseded) {
|
||||||
return !$scope.isPlanVisible(superseded, subscribedPlan);
|
return !$scope.isPlanVisible(superseded, subscribedPlan);
|
||||||
}
|
}
|
||||||
return plan == subscribedPlan;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.organization && !PlanService.isOrgCompatible(plan)) {
|
return plan.stripeId === subscribedPlan.stripeId;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -53,7 +54,7 @@ angular.module('quay').directive('planManager', function () {
|
||||||
return $scope.isPlanActive(plan, PlanService.getPlanImmediately(subscribedPlan['superseded_by']));
|
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) {
|
$scope.changeSubscription = function(planId, opt_async) {
|
||||||
|
|
Reference in a new issue