# HG changeset patch # User Mads Kiilerich # Date 2018-02-21 01:27:43 # Node ID bedccdc47bd9e9e29127a1202924544a0130c990 # Parent 65069004c2a2b3abed68be11ab4164b103392d74 comments: don't leave stray "Add Another Comment" buttons after cancelling adding comments on a new line 2e72d2d16a0f introduced an invisible "submitting" div above comment forms. That div was included when counting the number of comments on a line, and it thus broke the logic for removing the last DOM elements after cancelling comments on a new line. To fix that, exclude the submitting div in the selector used for counting comments. diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js --- a/kallithea/public/js/base.js +++ b/kallithea/public/js/base.js @@ -620,7 +620,7 @@ function comment_div_state($comment_div, var show_form = show_form_opt !== undefined ? show_form_opt : !f_path && !line_no; var $forms = $comment_div.children('.comment-inline-form'); var $buttonrow = $comment_div.children('.add-button-row'); - var $comments = $comment_div.children('.comment'); + var $comments = $comment_div.children('.comment:not(.submitting)'); $forms.remove(); $buttonrow.remove(); if (show_form) {