Performance improvements for the repo API and the new repo UI
This commit is contained in:
parent
bc6baae050
commit
ab2331a486
9 changed files with 119 additions and 100 deletions
|
@ -188,16 +188,9 @@ class Repository(RepositoryParamResource):
|
|||
|
||||
return tag_info
|
||||
|
||||
organization = None
|
||||
try:
|
||||
organization = model.get_organization(namespace)
|
||||
except model.InvalidOrganizationException:
|
||||
pass
|
||||
|
||||
is_public = model.repository_is_public(namespace, repository)
|
||||
repo = model.get_repository(namespace, repository)
|
||||
if repo:
|
||||
tags = model.list_repository_tags(namespace, repository)
|
||||
tags = model.list_repository_tags(namespace, repository, include_storage=True)
|
||||
tag_dict = {tag.name: tag_view(tag) for tag in tags}
|
||||
can_write = ModifyRepositoryPermission(namespace, repository).can()
|
||||
can_admin = AdministerRepositoryPermission(namespace, repository).can()
|
||||
|
@ -206,6 +199,7 @@ class Repository(RepositoryParamResource):
|
|||
|
||||
is_starred = (model.repository_is_starred(get_authenticated_user(), repo)
|
||||
if get_authenticated_user() else False)
|
||||
is_public = model.is_repository_public(repo)
|
||||
|
||||
return {
|
||||
'namespace': namespace,
|
||||
|
@ -216,7 +210,7 @@ class Repository(RepositoryParamResource):
|
|||
'can_admin': can_admin,
|
||||
'is_public': is_public,
|
||||
'is_building': len(list(active_builds)) > 0,
|
||||
'is_organization': bool(organization),
|
||||
'is_organization': repo.namespace_user.organization,
|
||||
'is_starred': is_starred,
|
||||
'status_token': repo.badge_token if not is_public else '',
|
||||
'stats': {
|
||||
|
|
Reference in a new issue