# HG changeset patch # User Mads Kiilerich # Date 1503890740 -7200 # 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 -r 95e5d449f702 -r f0ec7be78077 kallithea/controllers/changelog.py --- a/kallithea/controllers/changelog.py Sun Jul 02 22:19:12 2017 +0200 +++ b/kallithea/controllers/changelog.py Mon Aug 28 05:25:40 2017 +0200 @@ -61,8 +61,8 @@ 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 @@ 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 -r 95e5d449f702 -r f0ec7be78077 kallithea/controllers/compare.py --- a/kallithea/controllers/compare.py Sun Jul 02 22:19:12 2017 +0200 +++ b/kallithea/controllers/compare.py Mon Aug 28 05:25:40 2017 +0200 @@ -223,7 +223,7 @@ 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 -r 95e5d449f702 -r f0ec7be78077 kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py Sun Jul 02 22:19:12 2017 +0200 +++ b/kallithea/controllers/pullrequests.py Mon Aug 28 05:25:40 2017 +0200 @@ -578,7 +578,7 @@ 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 @@ 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 -r 95e5d449f702 -r f0ec7be78077 kallithea/templates/changelog/changelog.html --- a/kallithea/templates/changelog/changelog.html Sun Jul 02 22:19:12 2017 +0200 +++ b/kallithea/templates/changelog/changelog.html Mon Aug 28 05:25:40 2017 +0200 @@ -81,15 +81,15 @@ %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 @@ %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 -r 95e5d449f702 -r f0ec7be78077 kallithea/templates/changelog/changelog_summary_data.html --- a/kallithea/templates/changelog/changelog_summary_data.html Sun Jul 02 22:19:12 2017 +0200 +++ b/kallithea/templates/changelog/changelog_summary_data.html Mon Aug 28 05:25:40 2017 +0200 @@ -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 -r 95e5d449f702 -r f0ec7be78077 kallithea/templates/compare/compare_cs.html --- a/kallithea/templates/compare/compare_cs.html Sun Jul 02 22:19:12 2017 +0200 +++ b/kallithea/templates/compare/compare_cs.html Mon Aug 28 05:25:40 2017 +0200 @@ -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):