Fix plans manager display to be less confusing when we show deprecated plans
This commit is contained in:
parent
e06a83faf9
commit
0a176d0abe
3 changed files with 15 additions and 27 deletions
|
@ -29,14 +29,8 @@ angular.module('quay').directive('planManager', function () {
|
|||
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.
|
||||
// A plan is visible if it is not deprecated, or if it is the namespace's current plan.
|
||||
if (plan['deprecated']) {
|
||||
var superseded = PlanService.getPlanImmediately(plan['superseded_by']);
|
||||
if (superseded) {
|
||||
return !$scope.isPlanVisible(superseded, subscribedPlan);
|
||||
}
|
||||
|
||||
return subscribedPlan && plan.stripeId === subscribedPlan.stripeId;
|
||||
}
|
||||
|
||||
|
@ -44,16 +38,10 @@ angular.module('quay').directive('planManager', function () {
|
|||
};
|
||||
|
||||
$scope.isPlanActive = function(plan, subscribedPlan) {
|
||||
// A plan is active if it is either the plan directly subscribed to by the user
|
||||
// or the plan which supersedes the plan to which the user is subscribed.
|
||||
if (!subscribedPlan) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (subscribedPlan['deprecated'] && subscribedPlan['superseded_by']) {
|
||||
return $scope.isPlanActive(plan, PlanService.getPlanImmediately(subscribedPlan['superseded_by']));
|
||||
}
|
||||
|
||||
|
||||
return plan.stripeId === subscribedPlan.stripeId;
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue