Merge branch 'master' of ssh://bitbucket.org/yackob03/quay

This commit is contained in:
Jake Moshenko 2014-06-09 14:44:09 -04:00
commit 135859bc30
3 changed files with 14 additions and 8 deletions

View file

@ -61,6 +61,8 @@ def github_oauth_callback():
token = exchange_github_code_for_token(request.args.get('code')) token = exchange_github_code_for_token(request.args.get('code'))
user_data = get_github_user(token) user_data = get_github_user(token)
if not user_data:
return render_page_template('githuberror.html', error_message='Could not load user data')
username = user_data['login'] username = user_data['login']
github_id = user_data['id'] github_id = user_data['id']
@ -112,6 +114,9 @@ def github_oauth_callback():
def github_oauth_attach(): def github_oauth_attach():
token = exchange_github_code_for_token(request.args.get('code')) token = exchange_github_code_for_token(request.args.get('code'))
user_data = get_github_user(token) user_data = get_github_user(token)
if not user_data:
return render_page_template('githuberror.html', error_message='Could not load user data')
github_id = user_data['id'] github_id = user_data['id']
user_obj = current_user.db_user() user_obj = current_user.db_user()
model.attach_federated_login(user_obj, 'github', github_id) model.attach_federated_login(user_obj, 'github', github_id)

View file

@ -1093,20 +1093,17 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
planService.verifyLoaded = function(callback) { planService.verifyLoaded = function(callback) {
if (!Features.BILLING) { return; } if (!Features.BILLING) { return; }
if (plans) { if (plans && plans.length) {
callback(plans); callback(plans);
return; return;
} }
ApiService.listPlans().then(function(data) { ApiService.listPlans().then(function(data) {
var i = 0; plans = data.plans || [];
for(i = 0; i < data.plans.length; i++) { for(var i = 0; i < plans.length; i++) {
planDict[data.plans[i].stripeId] = data.plans[i]; planDict[plans[i].stripeId] = plans[i];
}
plans = data.plans;
if (plans) {
callback(plans);
} }
callback(plans);
}, function() { callback([]); }); }, function() { callback([]); });
}; };

View file

@ -942,6 +942,8 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope
}; };
$scope.handleBuildStarted = function(newBuild) { $scope.handleBuildStarted = function(newBuild) {
if (!$scope.builds) { return; }
$scope.builds.unshift(newBuild); $scope.builds.unshift(newBuild);
$scope.setCurrentBuild(newBuild['id'], true); $scope.setCurrentBuild(newBuild['id'], true);
}; };
@ -980,6 +982,8 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope
}; };
ApiService.requestRepoBuild(data, params).then(function(newBuild) { ApiService.requestRepoBuild(data, params).then(function(newBuild) {
if (!$scope.builds) { return; }
$scope.builds.unshift(newBuild); $scope.builds.unshift(newBuild);
$scope.setCurrentBuild(newBuild['id'], true); $scope.setCurrentBuild(newBuild['id'], true);
}); });