Changeset - ba7c0397c3c1
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 5 years ago 2021-02-22 12:12:38
mads@kiilerich.com
comments: don't open comment form on page load for comments on line 0

Data attributes have magic parsing of strings so '0' becomes 0 which is false.

Further, 0 == '' in JavaScript, so we have to use !== '' to catch empty strings.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -525,13 +525,13 @@ function move_comments($anchorcomments) 
 
        var target_id = $anchorcomment.data('target-id');
 
        var $comment_div = _get_add_comment_div(target_id);
 
        var f_path = $anchorcomment.data('f_path');
 
        var line_no = $anchorcomment.data('line_no');
 
        if ($comment_div[0]) {
 
            $comment_div.append($anchorcomment.children());
 
            if (f_path && line_no) {
 
            if (f_path && line_no !== '') {
 
                _comment_div_append_add($comment_div, f_path, line_no);
 
            } else {
 
                _comment_div_append_form($comment_div, f_path, line_no);
 
            }
 
        } else {
 
            $anchorcomment.before("<span class='bg-warning'>Comment to {0} line {1} which is outside the diff context:</span>".format(f_path || '?', line_no || '?'));
0 comments (0 inline, 0 general)