Mercurial > kallithea
changeset 6841:f0ec7be78077
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.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 28 Aug 2017 05:25:40 +0200 |
parents | 95e5d449f702 |
children | 651e37ed51c6 |
files | kallithea/controllers/changelog.py kallithea/controllers/compare.py kallithea/controllers/pullrequests.py kallithea/templates/changelog/changelog.html kallithea/templates/changelog/changelog_summary_data.html kallithea/templates/compare/compare_cs.html |
diffstat | 6 files changed, 29 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- 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))
--- 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)
--- 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,
--- 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 </td> <td class="status"> - %if c.statuses.get(cs.raw_id): - %if c.statuses.get(cs.raw_id)[2]: - <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username, c.statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}"> - <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i> + %if c.cs_statuses.get(cs.raw_id): + %if c.cs_statuses.get(cs.raw_id)[2]: + <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username, c.cs_statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.cs_statuses.get(cs.raw_id)[3],pull_request_id=c.cs_statuses.get(cs.raw_id)[2])}"> + <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i> </a> %else: - <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username)}" - href="${c.comments[cs.raw_id][0].url()}"> - <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i> + <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username)}" + href="${c.cs_comments[cs.raw_id][0].url()}"> + <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i> </a> %endif %endif @@ -121,9 +121,9 @@ %endif </div> <div class="extra-container"> - %if c.comments.get(cs.raw_id): - <a class="comments-container comments-cnt" href="${c.comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(c.comments[cs.raw_id])}"> - ${len(c.comments[cs.raw_id])} + %if c.cs_comments.get(cs.raw_id): + <a class="comments-container comments-cnt" href="${c.cs_comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(c.cs_comments[cs.raw_id])}"> + ${len(c.cs_comments[cs.raw_id])} <i class="icon-comment-discussion"></i> </a> %endif
--- 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): <tr class="parity${cnt%2} ${'mergerow' if len(cs.parents) > 1 else ''}"> <td class="compact"> - %if c.statuses.get(cs.raw_id): - %if c.statuses.get(cs.raw_id)[2]: - <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username, c.statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}"> - <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i> + %if c.cs_statuses.get(cs.raw_id): + %if c.cs_statuses.get(cs.raw_id)[2]: + <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username, c.cs_statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.cs_statuses.get(cs.raw_id)[3],pull_request_id=c.cs_statuses.get(cs.raw_id)[2])}"> + <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i> </a> %else: - <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username)}" - href="${c.comments[cs.raw_id][0].url()}"> - <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i> + <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username)}" + href="${c.cs_comments[cs.raw_id][0].url()}"> + <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i> </a> %endif %endif </td> <td class="compact"> - %if c.comments.get(cs.raw_id,[]): + %if c.cs_comments.get(cs.raw_id,[]): <div class="comments-container"> <div title="${('comments')}"> - <a href="${c.comments[cs.raw_id][0].url()}"> - <i class="icon-comment"></i>${len(c.comments[cs.raw_id])} + <a href="${c.cs_comments[cs.raw_id][0].url()}"> + <i class="icon-comment"></i>${len(c.cs_comments[cs.raw_id])} </a> </div> </div>
--- 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)): <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}"> <td> - %if cs.raw_id in c.statuses: - <i class="icon-circle changeset-status-${c.statuses[cs.raw_id][0]}" title="${_('Changeset status: %s') % c.statuses[cs.raw_id][1]}"></i> + %if cs.raw_id in c.cs_statuses: + <i class="icon-circle changeset-status-${c.cs_statuses[cs.raw_id][0]}" title="${_('Changeset status: %s') % c.cs_statuses[cs.raw_id][1]}"></i> %endif %if c.cs_comments.get(cs.raw_id): <div class="comments-container">