<p dir="ltr"><br>
On Feb 25, 2016 00:42, "Angel Ezquerra" <<a href="mailto:angel.ezquerra@gmail.com">angel.ezquerra@gmail.com</a>> wrote:<br>
><br>
> # HG changeset patch<br>
> # User Angel Ezquerra <<a href="mailto:angel.ezquerra@gmail.com">angel.ezquerra@gmail.com</a>><br>
> # Date 1456357243 -3600<br>
> #      Thu Feb 25 00:40:43 2016 +0100<br>
> # Node ID bad39285457d673a2fa3e6d80ece3a600812c32c<br>
> # Parent  05a85a6cecba5c8caeb7996590365d5d9bc523c9<br>
> summary, changelog: make the number of comments indicator more accurate<br>
><br>
> Up until now the number of comments indicator counted both actual comments and<br>
> status changes. This was not particularly useful, since the status information<br>
> is already shown on the status icon, and opening a changeset page just to see<br>
> that it has had its status changed (with no textual comments) is quite annoying.<br>
><br>
> Instead, show the number of "actual" comments (i.e. those that have some comment<br>
> text).<br>
><br>
> diff --git a/kallithea/templates/changelog/changelog.html b/kallithea/templates/changelog/changelog.html<br>
> --- a/kallithea/templates/changelog/changelog.html<br>
> +++ b/kallithea/templates/changelog/changelog.html<br>
> @@ -120,15 +120,19 @@<br>
>                              <div class="log-container"><br>
>                                  <div class="message" id="C-${cs.raw_id}">${h.urlify_commit(cs.message, c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div><br>
>                                  <div class="extra-container"><br>
> -                                    %if c.comments.get(cs.raw_id):<br>
> +                                    <% comments_and_status_changes = c.comments.get(cs.raw_id,[]) %><br>
> +                                    %if comments_and_status_changes:<br>
> +                                        <% num_actual_comments = len([cm for cm in comments_and_status_changes if cm.text]) %><br>
> +                                        %if num_actual_comments:<br>
>                                          <div class="comments-container"><br>
>                                              <div class="comments-cnt" title="${_('Changeset has comments')}"><br>
>                                                  <a href="${c.comments[cs.raw_id][0].url()}"><br>
> -                                                    ${len(c.comments[cs.raw_id])}<br>
> +                                                    ${num_actual_comments}<br>
>                                                      <i class="icon-comment-discussion"></i><br>
>                                                  </a><br>
>                                              </div><br>
>                                          </div><br>
> +                                        %endif<br>
>                                      %endif<br>
>                                      %if h.is_hg(c.db_repo_scm_instance):<br>
>                                          %for book in cs.bookmarks:<br>
> diff --git a/kallithea/templates/changelog/changelog_summary_data.html b/kallithea/templates/changelog/changelog_summary_data.html<br>
> --- a/kallithea/templates/changelog/changelog_summary_data.html<br>
> +++ b/kallithea/templates/changelog/changelog_summary_data.html<br>
> @@ -31,15 +31,19 @@<br>
>              </div><br>
>          </td><br>
>          <td class="compact"><br>
> -              %if c.comments.get(cs.raw_id,[]):<br>
> -               <div class="comments-container"><br>
> -                   <div title="${('comments')}"><br>
> -                       <a href="${c.comments[cs.raw_id][0].url()}"><br>
> -                          <i class="icon-comment"></i>${len(c.comments[cs.raw_id])}<br>
> -                       </a><br>
> -                   </div><br>
> -               </div><br>
> +            <% comments_and_status_changes = c.comments.get(cs.raw_id,[]) %><br>
> +            %if comments_and_status_changes:<br>
> +              <% num_actual_comments = len([cm for cm in comments_and_status_changes if cm.text]) %><br>
> +              %if num_actual_comments:<br>
> +                 <div class="comments-container"><br>
> +                     <div title="${('comments')}"><br>
> +                         <a href="${c.comments[cs.raw_id][0].url()}"><br>
> +                             <i class="icon-comment"></i>${num_actual_comments}<br>
> +                         </a><br>
> +                     </div><br>
> +                 </div><br>
>                %endif<br>
> +            %endif<br>
>          </td><br>
>          <td><br>
>              <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}" class="revision-link">${h.show_id(cs)}</a><br>
><br>
></p>
<p dir="ltr">There are other places that count comments, like pull requests, did you check if the comments are correctly counted there?</p>
<p dir="ltr">It also looks better to me to move this counting logic out of the template and into the controller or even model.</p>
<p dir="ltr">/Thomas</p>