diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako --- a/rhodecode/templates/codeblocks/diffs.mako +++ b/rhodecode/templates/codeblocks/diffs.mako @@ -253,8 +253,16 @@ return '%s_%s_%i' % (h.md5_safe(commit+f data-anchor-id="${h.FID(filediff.raw_id, filediff.patch['filename'])}" > ${diff_menu(filediff, use_comments=use_comments)} @@ -484,7 +492,7 @@ from rhodecode.lib.diffs import NEW_FILE <% final_path = filediff.target_file_path %> %endif %endif - + ## anchor link ΒΆ @@ -615,6 +623,19 @@ from rhodecode.lib.diffs import NEW_FILE <%! + +def get_inline_comments(comments, filename): + if hasattr(filename, 'unicode_path'): + filename = filename.unicode_path + + if not isinstance(filename, (unicode, str)): + return None + + if comments and filename in comments: + return comments[filename] + + return None + def get_comments_for(diff_type, comments, filename, line_version, line_number): if hasattr(filename, 'unicode_path'): filename = filename.unicode_path @@ -622,13 +643,14 @@ def get_comments_for(diff_type, comments if not isinstance(filename, (unicode, str)): return None - line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12 + file_comments = get_inline_comments(comments, filename) + if file_comments is None: + return None - if comments and filename in comments: - file_comments = comments[filename] - if line_key in file_comments: - data = file_comments.pop(line_key) - return data + line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12 + if line_key in file_comments: + data = file_comments.pop(line_key) + return data %> <%def name="render_hunk_lines_sideside(filediff, hunk, use_comments=False, inline_comments=None, active_pattern_entries=None)">