[PATCH] changeset comment: fix delete button issue

Jan Heylen heyleke at gmail.com
Fri May 29 12:19:29 EDT 2015


# HG changeset patch
# User Jan Heylen <heyleke at gmail.com>
# Date 1432916303 -7200
#      Fri May 29 18:18:23 2015 +0200
# Node ID 4389cb3933f931bb5761eee8bd778779b6a1c495
# Parent  2c1ae0b188ae5f5fde6369f76803a1170592b90d
changeset comment: fix delete button issue

issue:
when deleting comments in a list of comments on the same line,
sometimes the add new comment button stops working

root cause:
when deleting a comment in a list of comments that are all on the same line,
the wrong previous tr is chosen, the chosen tr could be an inline comments
instead of a line tr, resulting in the fact that injectinlineform function
will return immediatly

solution:
loop over the found tr until its no longer an inline comment

remark:
could probably be optimised futher to immediatly search for the line tr object

diff -r 2c1ae0b188ae -r 4389cb3933f9 kallithea/public/js/base.js
--- a/kallithea/public/js/base.js	Wed May 27 23:15:36 2015 +0200
+++ b/kallithea/public/js/base.js	Fri May 29 18:18:23 2015 +0200
@@ -735,6 +735,9 @@
     var success = function(o){
         var $deleted = $('#comment-tr-'+comment_id);
         var $prev = $deleted.prev('tr');
+        while ($prev.hasClass('inline-comments')){
+            $prev = $prev.prev('tr');
+        }
         $deleted.remove();
         _placeAddButton($prev);
     }


More information about the kallithea-general mailing list