1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

Fixed bug in viewing repo when has shared repos.

This commit is contained in:
ZhengXie
2012-10-09 14:06:00 +08:00
parent 33d3758631
commit 4fba6bd5ad
2 changed files with 15 additions and 7 deletions

View File

@@ -181,7 +181,7 @@ def get_accessible_repos(request, 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:
return False
@@ -222,12 +222,21 @@ def get_accessible_repos(request, repo):
return False
accessible_repos = []
for r in owned_repos + shared_repos + groups_repos:
if not has_repo(accessible_repos, r):
if not r.encrypted:
r.has_subdir = check_has_subdir(r)
accessible_repos.append(r)
for r in owned_repos:
if not has_repo(accessible_repos, r) and 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)
accessible_repos.append(r)
return accessible_repos
def valid_previewed_file(filename):