commits/summary: unify fetching remote attribute in summary and commits page to properly and in the same way show the data.

This commit is contained in:
RhodeCode Admin 2021-12-20 16:07:22 +01:00
parent eb95462c1a
commit da3f876a71
3 changed files with 11 additions and 8 deletions

View file

@ -389,6 +389,11 @@ class RepoAppView(BaseAppView):
return True
return False
def get_commit_preload_attrs(cls):
pre_load = ['author', 'branch', 'date', 'message', 'parents',
'obsolete', 'phase', 'hidden']
return pre_load
class PathFilter(object):

View file

@ -168,11 +168,6 @@ class RepoChangelogView(RepoAppView):
return c
def _get_preload_attrs(self):
pre_load = ['author', 'branch', 'date', 'message', 'parents',
'obsolete', 'phase', 'hidden']
return pre_load
@LoginRequired()
@HasRepoPermissionAnyDecorator(
'repository.read', 'repository.write', 'repository.admin')
@ -200,7 +195,7 @@ class RepoChangelogView(RepoAppView):
self._check_if_valid_branch(branch_name, self.db_repo_name, f_path)
c.changelog_for_path = f_path
pre_load = self._get_preload_attrs()
pre_load = self.get_commit_preload_attrs()
partial_xhr = self.request.environ.get('HTTP_X_PARTIAL_XHR')
@ -256,6 +251,8 @@ class RepoChangelogView(RepoAppView):
raise HTTPFound(
h.route_path('repo_summary', repo_name=self.db_repo_name))
if partial_xhr or self.request.environ.get('HTTP_X_PJAX'):
# case when loading dynamic file history in file view
# loading from ajax, we don't want the first result, it's popped
@ -304,7 +301,7 @@ class RepoChangelogView(RepoAppView):
return wrap_for_error(
safe_str('Branch: {} is not valid'.format(branch_name)))
pre_load = self._get_preload_attrs()
pre_load = self.get_commit_preload_attrs()
if f_path:
try:

View file

@ -65,7 +65,8 @@ class RepoSummaryView(RepoAppView):
'repo_summary_commits',
repo_name=c.rhodecode_db_repo.repo_name, _query=query_params)
pre_load = ['author', 'branch', 'date', 'message']
pre_load = self.get_commit_preload_attrs()
try:
collection = self.rhodecode_vcs_repo.get_commits(
pre_load=pre_load, translate_tags=False)