Changeset - 169539b32b90
[Not reviewed]
default
0 3 0
Mads Kiilerich - 6 years ago 2020-02-25 18:18:44
mads@kiilerich.com
Grafted from: 779493225629
js: fix missing var declaration of AJAX_COMMENT_URL and AJAX_COMMENT_DELETE_URL (Issue #362)

Tech debt stroke back when fb9550946c26 cleaned things up.

Eslint wearnings for these variables had incorrectly been manually ignored.
3 files changed with 6 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -590,12 +590,13 @@ function _comment_div_append_add($commen
 
    $add.children('.add-button').click(function() {
 
        comment_div_state($comment_div, f_path, line_no, true);
 
    });
 
}
 

	
 
// append a comment form to $comment_div
 
// Note: var AJAX_COMMENT_URL must have been defined before invoking this function
 
function _comment_div_append_form($comment_div, f_path, line_no) {
 
    var $form_div = $('#comment-inline-form-template').children()
 
        .clone()
 
        .addClass('comment-inline-form');
 
    $comment_div.append($form_div);
 
    var $preview = $comment_div.find("div.comment-preview");
 
@@ -706,12 +707,13 @@ function _comment_div_append_form($comme
 
    if (f_path) {
 
        $textarea.focus();
 
    }
 
}
 

	
 

	
 
// Note: var AJAX_COMMENT_URL must have been defined before invoking this function
 
function deleteComment(comment_id) {
 
    var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__', comment_id);
 
    var postData = {};
 
    function success() {
 
        $('#comment-'+comment_id).remove();
 
        // Ignore that this might leave a stray Add button (or have a pending form with another comment) ...
kallithea/templates/changeset/changeset.html
Show inline comments
 
@@ -20,14 +20,14 @@
 
${self.repo_context_bar('changelog', c.changeset.raw_id)}
 
<div class="panel panel-primary">
 
  <div class="panel-heading clearfix">
 
    ${self.breadcrumbs()}
 
  </div>
 
  <script>'use strict';
 
    AJAX_COMMENT_URL = ${h.js(url('changeset_comment',repo_name=c.repo_name,revision=c.changeset.raw_id))};
 
    AJAX_COMMENT_DELETE_URL = ${h.js(url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
 
    var AJAX_COMMENT_URL = ${h.js(url('changeset_comment',repo_name=c.repo_name,revision=c.changeset.raw_id))};
 
    var AJAX_COMMENT_DELETE_URL = ${h.js(url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
 
  </script>
 
  <div class="panel-body">
 
    <div class="panel panel-default">
 
        <div class="panel-heading clearfix">
 
            ${self.parent_child_navigation()}
 

	
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -311,14 +311,14 @@ ${self.repo_context_bar('showpullrequest
 
              </div>
 
            </div>
 
        </div>
 
    </div>
 
    <script>'use strict';
 
    // TODO: switch this to pyroutes
 
    AJAX_COMMENT_URL = ${h.js(url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id))};
 
    AJAX_COMMENT_DELETE_URL = ${h.js(url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
 
    var AJAX_COMMENT_URL = ${h.js(url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id))};
 
    var AJAX_COMMENT_DELETE_URL = ${h.js(url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
 

	
 
    pyroutes.register('pullrequest_comment', ${h.js(url('pullrequest_comment',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s'))}, ['repo_name', 'pull_request_id']);
 
    pyroutes.register('pullrequest_comment_delete', ${h.js(url('pullrequest_comment_delete',repo_name='%(repo_name)s',comment_id='%(comment_id)s'))}, ['repo_name', 'comment_id']);
 

	
 
    </script>
 

	
0 comments (0 inline, 0 general)