changes to reflect PR comments (not finished)

This commit is contained in:
Jimmy Zelinskie 2015-02-24 17:50:54 -05:00
parent 758158391c
commit fb0d3d69c2
8 changed files with 32 additions and 172 deletions

View file

@ -110,11 +110,13 @@ class RepositoryList(ApiResource):
def get(self, args):
"""Fetch the list of repositories under a variety of situations."""
username = None
if get_authenticated_user() and args['private']:
username = get_authenticated_user().username
if get_authenticated_user():
starred_repos = model.get_user_starred_repositories(get_authenticated_user())
star_lookup = set([repo.id for repo in starred_repos])
if args['private']:
username = get_authenticated_user().username
response = {}
repo_count = None
@ -133,7 +135,7 @@ class RepositoryList(ApiResource):
'description': repo_obj.description,
'is_public': repo_obj.visibility.name == 'public',
}
if get_authenticated_user() and args['private']:
if get_authenticated_user():
repo['is_starred'] = repo_obj.id in star_lookup
return repo