Pass whether an orgazanition is creating the plan to the plan service to calculate the next minimum plan.

This commit is contained in:
yackob03 2013-11-05 14:47:48 -05:00
parent eee858ecc5
commit ac72a8d86d

View file

@ -981,7 +981,7 @@ function NewRepoCtrl($scope, $location, $http, $timeout, UserService, Restangula
var privateAllowed = $scope.subscription.usedPrivateRepos < $scope.subscribedPlan.privateRepos;
if (!privateAllowed) {
// If not, find the minimum repository that does.
PlanService.getMinimumPlan($scope.subscription.usedPrivateRepos + 1, function(minimum) {
PlanService.getMinimumPlan($scope.subscription.usedPrivateRepos + 1, !$scope.isUserNamespace, function(minimum) {
$scope.planRequired = minimum;
});
}
@ -1045,6 +1045,7 @@ function NewRepoCtrl($scope, $location, $http, $timeout, UserService, Restangula
// Watch the namespace on the repo. If it changes, we update the plan and the public/private
// accordingly.
$scope.isUserNamespace = true;
$scope.$watch('repo.namespace', function(namespace) {
// Note: Can initially be undefined.
if (!namespace) { return; }
@ -1058,7 +1059,7 @@ function NewRepoCtrl($scope, $location, $http, $timeout, UserService, Restangula
// Load the user's subscription information in case they want to create a private
// repository.
UserService.getCurrentSubscription(subscribedToPlan, function() {
PlanService.getMinimumPlan(1, function(minimum) { $scope.planRequired = minimum; });
PlanService.getMinimumPlan(1, false, function(minimum) { $scope.planRequired = minimum; });
});
} else {
$scope.planRequired = null;