# HG changeset patch # User Marcin Kuzminski # Date 2017-11-17 18:10:55 # Node ID 8a477b72d1601e03c7b0498255935426cc94e61c # Parent dcdc2cc41241edb8abe145d3dc58f6df12e2d69d comments: allow to properly initialize outdated comments that are attached to the end of diffs. This allows resolving todos that are outdated. diff --git a/rhodecode/public/js/src/rhodecode/comments.js b/rhodecode/public/js/src/rhodecode/comments.js --- a/rhodecode/public/js/src/rhodecode/comments.js +++ b/rhodecode/public/js/src/rhodecode/comments.js @@ -475,7 +475,12 @@ var CommentsController = function() { this.getLineNumber = function(node) { var $node = $(node); - return $node.closest('td').attr('data-line-number'); + var lineNo = $node.closest('td').attr('data-line-number'); + if (lineNo === undefined && $node.data('commentInline')){ + lineNo = $node.data('commentLineNo') + } + + return lineNo }; this.scrollToComment = function(node, offset, outdated) { @@ -801,30 +806,4 @@ var CommentsController = function() { return false; }; - this.renderInlineComments = function(file_comments) { - show_add_button = typeof show_add_button !== 'undefined' ? show_add_button : true; - - for (var i = 0; i < file_comments.length; i++) { - var box = file_comments[i]; - - var target_id = $(box).attr('target_id'); - - // actually comments with line numbers - var comments = box.children; - - for (var j = 0; j < comments.length; j++) { - var data = { - 'rendered_text': comments[j].outerHTML, - 'line_no': $(comments[j]).attr('line'), - 'target_id': target_id - }; - } - } - - // since order of injection is random, we're now re-iterating - // from correct order and filling in links - linkifyComments($('.inline-comment-injected')); - firefoxAnchorFix(); - }; - }; diff --git a/rhodecode/templates/changeset/changeset_file_comment.mako b/rhodecode/templates/changeset/changeset_file_comment.mako --- a/rhodecode/templates/changeset/changeset_file_comment.mako +++ b/rhodecode/templates/changeset/changeset_file_comment.mako @@ -21,6 +21,7 @@ line="${comment.line_no}" data-comment-id="${comment.comment_id}" data-comment-type="${comment.comment_type}" + data-comment-line-no="${comment.line_no}" data-comment-inline=${h.json.dumps(inline)} style="${'display: none;' if outdated_at_ver else ''}">