mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
Fixed bug in viewing repo when has shared repos.
This commit is contained in:
@@ -352,7 +352,6 @@ def get_org_repos(org_id, start, limit):
|
|||||||
if repos:
|
if repos:
|
||||||
for r in repos:
|
for r in repos:
|
||||||
r.owner = get_org_repo_owner(r.id)
|
r.owner = get_org_repo_owner(r.id)
|
||||||
print org_id, type(org_id), r.id, r.owner
|
|
||||||
|
|
||||||
return repos
|
return repos
|
||||||
|
|
||||||
|
17
utils.py
17
utils.py
@@ -181,7 +181,7 @@ def get_accessible_repos(request, repo):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
def check_has_subdir(repo):
|
def check_has_subdir(repo):
|
||||||
latest_commit = get_commits(repo.props.id, 0, 1)[0]
|
latest_commit = get_commits(repo.id, 0, 1)[0]
|
||||||
if latest_commit.root_id == EMPTY_SHA1:
|
if latest_commit.root_id == EMPTY_SHA1:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -222,9 +222,18 @@ def get_accessible_repos(request, repo):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
accessible_repos = []
|
accessible_repos = []
|
||||||
for r in owned_repos + shared_repos + groups_repos:
|
for r in owned_repos:
|
||||||
if not has_repo(accessible_repos, r):
|
if not has_repo(accessible_repos, r) and not r.encrypted:
|
||||||
if not r.encrypted:
|
r.has_subdir = check_has_subdir(r)
|
||||||
|
accessible_repos.append(r)
|
||||||
|
|
||||||
|
for r in shared_repos + groups_repos:
|
||||||
|
if not has_repo(accessible_repos, r) and not r.encrypted:
|
||||||
|
# For compatibility with diffrent fields names in Repo and
|
||||||
|
# SharedRepo objects.
|
||||||
|
r.id = r.repo_id
|
||||||
|
r.name = r.repo_name
|
||||||
|
r.desc = r.repo_desc
|
||||||
r.has_subdir = check_has_subdir(r)
|
r.has_subdir = check_has_subdir(r)
|
||||||
accessible_repos.append(r)
|
accessible_repos.append(r)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user