# HG changeset patch # User Mads Kiilerich # Date 2017-08-28 05:25:40 # Node ID f0ec7be7807766201cde330f9caeef25ec1a6d6a # Parent 95e5d449f7025574a0a4f853be474b6b67890f83 controllers: consistently use c.cs_comments and cs_statuses c.comments and c.statuses were also used for lists of comments and statuses. To get more consistency and avoid confusion and conflicts, use different for names for mappings from changeset hashes. diff --git a/kallithea/controllers/changelog.py b/kallithea/controllers/changelog.py --- a/kallithea/controllers/changelog.py +++ b/kallithea/controllers/changelog.py @@ -61,8 +61,8 @@ def _load_changelog_summary(): items_per_page=size, url=url_generator) page_revisions = [x.raw_id for x in list(c.repo_changesets)] - c.comments = c.db_repo.get_comments(page_revisions) - c.statuses = c.db_repo.statuses(page_revisions) + c.cs_comments = c.db_repo.get_comments(page_revisions) + c.cs_statuses = c.db_repo.statuses(page_revisions) class ChangelogController(BaseRepoController): @@ -150,8 +150,8 @@ class ChangelogController(BaseRepoContro items_per_page=c.size, branch=branch_name,) page_revisions = [x.raw_id for x in c.pagination] - c.comments = c.db_repo.get_comments(page_revisions) - c.statuses = c.db_repo.statuses(page_revisions) + c.cs_comments = c.db_repo.get_comments(page_revisions) + c.cs_statuses = c.db_repo.statuses(page_revisions) except EmptyRepositoryError as e: h.flash(safe_str(e), category='warning') raise HTTPFound(location=url('summary_home', repo_name=c.repo_name)) diff --git a/kallithea/controllers/compare.py b/kallithea/controllers/compare.py --- a/kallithea/controllers/compare.py +++ b/kallithea/controllers/compare.py @@ -223,7 +223,7 @@ class CompareController(BaseRepoControll c.cs_repo.scm_instance, c.cs_rev) raw_ids = [x.raw_id for x in c.cs_ranges] c.cs_comments = c.cs_repo.get_comments(raw_ids) - c.statuses = c.cs_repo.statuses(raw_ids) + c.cs_statuses = c.cs_repo.statuses(raw_ids) revs = [ctx.revision for ctx in reversed(c.cs_ranges)] c.jsdata = graph_data(c.cs_repo.scm_instance, revs) diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -578,7 +578,7 @@ class PullrequestsController(BaseRepoCon raw_ids = [x.raw_id for x in c.cs_ranges] c.cs_comments = c.cs_repo.get_comments(raw_ids) - c.statuses = c.cs_repo.statuses(raw_ids) + c.cs_statuses = c.cs_repo.statuses(raw_ids) ignore_whitespace = request.GET.get('ignorews') == '1' line_context = safe_int(request.GET.get('context'), 3) @@ -628,8 +628,7 @@ class PullrequestsController(BaseRepoCon for comments in lines.values(): c.inline_cnt += len(comments) # comments - c.comments = cc_model.get_comments(c.db_repo.repo_id, - pull_request=pull_request_id) + c.comments = cc_model.get_comments(c.db_repo.repo_id, pull_request=pull_request_id) # (badly named) pull-request status calculation based on reviewer votes (c.pull_request_reviewers, diff --git a/kallithea/templates/changelog/changelog.html b/kallithea/templates/changelog/changelog.html --- a/kallithea/templates/changelog/changelog.html +++ b/kallithea/templates/changelog/changelog.html @@ -81,15 +81,15 @@ ${self.repo_context_bar('changelog', c.f %endif - %if c.statuses.get(cs.raw_id): - %if c.statuses.get(cs.raw_id)[2]: - - + %if c.cs_statuses.get(cs.raw_id): + %if c.cs_statuses.get(cs.raw_id)[2]: + + %else: - - + + %endif %endif @@ -121,9 +121,9 @@ ${self.repo_context_bar('changelog', c.f %endif
- %if c.comments.get(cs.raw_id): - - ${len(c.comments[cs.raw_id])} + %if c.cs_comments.get(cs.raw_id): + + ${len(c.cs_comments[cs.raw_id])} %endif diff --git a/kallithea/templates/changelog/changelog_summary_data.html b/kallithea/templates/changelog/changelog_summary_data.html --- a/kallithea/templates/changelog/changelog_summary_data.html +++ b/kallithea/templates/changelog/changelog_summary_data.html @@ -13,25 +13,25 @@ %for cnt,cs in enumerate(c.repo_changesets): - %if c.statuses.get(cs.raw_id): - %if c.statuses.get(cs.raw_id)[2]: - - + %if c.cs_statuses.get(cs.raw_id): + %if c.cs_statuses.get(cs.raw_id)[2]: + + %else: - - + + %endif %endif - %if c.comments.get(cs.raw_id,[]): + %if c.cs_comments.get(cs.raw_id,[]): diff --git a/kallithea/templates/compare/compare_cs.html b/kallithea/templates/compare/compare_cs.html --- a/kallithea/templates/compare/compare_cs.html +++ b/kallithea/templates/compare/compare_cs.html @@ -33,8 +33,8 @@ %for cnt, cs in enumerate(reversed(c.cs_ranges)): - %if cs.raw_id in c.statuses: - + %if cs.raw_id in c.cs_statuses: + %endif %if c.cs_comments.get(cs.raw_id):