comments: allow to properly initialize outdated comments that are attached

to the end of diffs. This allows resolving todos that are outdated.
This commit is contained in:
Marcin Kuzminski 2017-11-17 19:10:55 +01:00
parent 8e40a60b08
commit 948b308e89
2 changed files with 7 additions and 27 deletions

View file

@ -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();
};
};

View file

@ -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 ''}">