Changeset - f0ec7be78077
[Not reviewed]
default
0 6 0
Mads Kiilerich - 8 years ago 2017-08-28 05:25:40
mads@kiilerich.com
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.
6 files changed with 29 insertions and 30 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/changelog.py
Show inline comments
 
@@ -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))
kallithea/controllers/compare.py
Show inline comments
 
@@ -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)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -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,
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -81,15 +81,15 @@ ${self.repo_context_bar('changelog', c.f
 
                            %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 @@ ${self.repo_context_bar('changelog', c.f
 
                                    %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
kallithea/templates/changelog/changelog_summary_data.html
Show inline comments
 
@@ -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>
kallithea/templates/compare/compare_cs.html
Show inline comments
 
@@ -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">
0 comments (0 inline, 0 general)