##// END OF EJS Templates
diffs: expose per-file comment counts.
marcink -
r4380:2d4194c7 stable
parent child Browse files
Show More
@@ -253,8 +253,16 b" return '%s_%s_%i' % (h.md5_safe(commit+f"
253 253 data-anchor-id="${h.FID(filediff.raw_id, filediff.patch['filename'])}"
254 254 >
255 255 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
256 <%
257 file_comments = (get_inline_comments(inline_comments, filediff.patch['filename']) or {}).values()
258 total_file_comments = [_c for _c in h.itertools.chain.from_iterable(file_comments) if not _c.outdated]
259 %>
256 260 <div class="filediff-collapse-indicator icon-"></div>
261 <span class="pill-group pull-right" >
262 <span class="pill"><i class="icon-comment"></i> ${len(total_file_comments)}</span>
263 </span>
257 264 ${diff_ops(filediff)}
265
258 266 </label>
259 267
260 268 ${diff_menu(filediff, use_comments=use_comments)}
@@ -484,7 +492,7 b' from rhodecode.lib.diffs import NEW_FILE'
484 492 <% final_path = filediff.target_file_path %>
485 493 %endif
486 494 %endif
487 <i style="color: #aaa" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy file path')}" onclick="return false;"></i>
495 <i style="color: #aaa" class="on-hover-icon icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy file path')}" onclick="return false;"></i>
488 496 </span>
489 497 ## anchor link
490 498 <a class="pill filediff-anchor" href="#a_${h.FID(filediff.raw_id, filediff.patch['filename'])}"></a>
@@ -615,6 +623,19 b' from rhodecode.lib.diffs import NEW_FILE'
615 623 </%def>
616 624
617 625 <%!
626
627 def get_inline_comments(comments, filename):
628 if hasattr(filename, 'unicode_path'):
629 filename = filename.unicode_path
630
631 if not isinstance(filename, (unicode, str)):
632 return None
633
634 if comments and filename in comments:
635 return comments[filename]
636
637 return None
638
618 639 def get_comments_for(diff_type, comments, filename, line_version, line_number):
619 640 if hasattr(filename, 'unicode_path'):
620 641 filename = filename.unicode_path
@@ -622,10 +643,11 b' def get_comments_for(diff_type, comments'
622 643 if not isinstance(filename, (unicode, str)):
623 644 return None
624 645
625 line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12
646 file_comments = get_inline_comments(comments, filename)
647 if file_comments is None:
648 return None
626 649
627 if comments and filename in comments:
628 file_comments = comments[filename]
650 line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12
629 651 if line_key in file_comments:
630 652 data = file_comments.pop(line_key)
631 653 return data
General Comments 0
You need to be logged in to leave comments. Login now