From: Max Kanat-Alexander Date: Fri, 22 Oct 2010 23:54:50 +0000 (-0700) Subject: Bug 473557: Make the "Collapse All Comments" link work properly even when X-Git-Tag: bugzilla-4.0rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aaa3c8be761e1d89f1a80545d59992d4be181d5e;p=thirdparty%2Fbugzilla.git Bug 473557: Make the "Collapse All Comments" link work properly even when the "comment order" preference is set to "newest to oldest with description at top" r=mkanat, a=mkanat --- diff --git a/js/comments.js b/js/comments.js index 697cedd20e..2f1a14406d 100644 --- a/js/comments.js +++ b/js/comments.js @@ -44,18 +44,18 @@ function toggle_comment_display(link, comment_id) { collapse_comment(link, comment); } -function toggle_all_comments(action, comments_size) { - var num_comments = comments_size; - +function toggle_all_comments(action) { // If for some given ID the comment doesn't exist, this doesn't mean // there are no more comments, but that the comment is private and // the user is not allowed to view it. - for (var id = 0; id < num_comments; id++) { - var comment = document.getElementById('comment_text_' + id); + var comments = YAHOO.util.Dom.getElementsByClassName('bz_comment_text'); + for (var i = 0; i < comments.length; i++) { + var comment = comments[i]; if (!comment) continue; + var id = comments[i].id.match(/\d*$/); var link = document.getElementById('comment_link_' + id); if (action == 'collapse') collapse_comment(link, comment); diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl index 4f7795b125..580ba6b5e3 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -82,9 +82,9 @@ [% IF mode == "edit" %]