Fix the repo search to include repos that you get through a team and repos for which you have admin on the org.

This commit is contained in:
yackob03 2013-11-07 22:44:18 -05:00
parent 52e82cfb10
commit d524559bce
3 changed files with 51 additions and 28 deletions

View file

@ -584,13 +584,11 @@ def match_repos_api():
@app.route('/api/repository/', methods=['GET'])
def list_repos_api():
def repo_view(repo_obj):
is_public = model.repository_is_public(repo_obj.namespace, repo_obj.name)
return {
'namespace': repo_obj.namespace,
'name': repo_obj.name,
'description': repo_obj.description,
'is_public': is_public
'is_public': repo_obj.visibility.name == 'public',
}
limit = request.args.get('limit', None)
@ -614,7 +612,8 @@ def list_repos_api():
repo_query = model.get_visible_repositories(username, limit=limit,
include_public=include_public,
sort=sort, namespace=namespace_filter)
sort=sort,
namespace=namespace_filter)
repos = [repo_view(repo) for repo in repo_query]
response = {
'repositories': repos