def _convert_to_commit_dict(request, commit_ids): commit_dict = {} allowed_view_access_repoId_set = Set() commits = RepoManager.list_commits_by_ids(commit_ids) repos = RepoManager.list_repo_by_ids( list(Set([x.repo_id for x in commits]))) for repo in repos: if repo.auth_type == 2: if not request.user.is_authenticated( ) or not RepoManager.is_allowed_view_access_repo( repo, request.user): continue allowed_view_access_repoId_set.add(repo.id) for commit in commits: if commit.repo_id in allowed_view_access_repoId_set: commit_dict[commit.id] = commit return commit_dict
def _fillwith_push_revref(request, feeds): revref_dict = {} for feed in feeds: if not feed.is_push_revref(): continue push_revref = RepoManager.get_pushrevref_by_id(feed.relative_id) if not push_revref: continue repo = RepoManager.get_repo_by_id(push_revref.repo_id) if repo and repo.auth_type == 2: if not request.user.is_authenticated( ) or not RepoManager.is_allowed_view_access_repo( repo, request.user): continue push_revref.commits = RepoManager.list_commit_by_repoId_pushrevrefId( push_revref.repo_id, push_revref.id, 0, 10) feed.relative_obj = push_revref