Hide repo star control when not logged in

Fixes #1756
This commit is contained in:
Joseph Schorr 2016-08-23 13:02:55 -04:00
parent de41c613e4
commit e3ed2c8a92
4 changed files with 15 additions and 5 deletions

View file

@ -13,7 +13,7 @@ angular.module('quay').directive('repoListTable', function () {
'namespaces': '=namespaces',
'starToggled': '&starToggled'
},
controller: function($scope, $element, $filter, TableService) {
controller: function($scope, $element, $filter, TableService, UserService) {
$scope.repositories = null;
$scope.orderedRepositories = [];
@ -93,6 +93,8 @@ angular.module('quay').directive('repoListTable', function () {
});
buildOrderedRepositories();
$scope.loggedIn = !UserService.currentUser().anonymous;
}, /* deep */ true);
}
};

View file

@ -13,6 +13,8 @@ angular.module('quay').directive('repoStar', function () {
starToggled: '&starToggled'
},
controller: function($scope, $element, UserService, ApiService) {
$scope.loggedIn = false;
// Star a repository or unstar a repository.
$scope.toggleStar = function() {
if ($scope.repository.is_starred) {
@ -46,6 +48,10 @@ angular.module('quay').directive('repoStar', function () {
$scope.starToggled({'repository': $scope.repository});
}, ApiService.errorDisplay('Could not unstar repository'));
};
$scope.$watch('repository', function() {
$scope.loggedIn = !UserService.currentUser().anonymous;
});
}
};