jenkins-bot has submitted this change and it was merged.
Change subject: (bug 25072) Fix weirdness in collapse threads
......................................................................
(bug 25072) Fix weirdness in collapse threads
The problem was the use of find(), which is fully recursive, instead of
children() (now using the children ">" selector with find as per Krinkle
comments), which only search for the inmediate children. Since this
function is called recursively for .lqt-thread-replies this prevents
adding nested replies twice.
Also, modified the toggleCollapse function adding
'.lqt-post-wrapper, .lqt-thread-replies' to children() so it only
hides and shows messages and thread replies, leaving other elements that
aren't displayed anyway. This is to prevent it from also hiding the title
of the entire thread, which also contains the action links: that was
increasing the weirdness on pages with several threads.
Change-Id: I520b0451d55f4eae2bbcf795c46f975b4b0af63b
---
M jquery/jquery.thread_collapse.js
1 file changed, 5 insertions(+), 6 deletions(-)
Approvals:
Matmarex: Looks good to me, but someone else must approve
Siebrand: Looks good to me, approved
DaSch: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/jquery/jquery.thread_collapse.js b/jquery/jquery.thread_collapse.js
index 3ea8d59..cd1d687 100644
--- a/jquery/jquery.thread_collapse.js
+++ b/jquery/jquery.thread_collapse.js
@@ -33,15 +33,14 @@
.bind( 'click.thread_collapse',
$.thread_collapse.fn.toggleCollapse )
.end() );
},
- // FIXME - appends parent nodes twice...bad logic here
'getPreview': function( thread, depth ) {
var $out = $( '<ul />' )
.addClass( 'thread-collapse-preview' )
.addClass(
'thread-collapse-preview-depth-' + depth )
.append( $( '<li />' )
- .append( thread.find(
'.lqt-post-wrapper:first .lqt-thread-signature' ).clone() )
+ .append( thread.find( '>
.lqt-post-wrapper > .lqt-thread-signature' ).clone() )
);
- thread.find( '.lqt-thread-replies' ).children(
'.lqt_thread' ).each( function() {
+ thread.find( '> .lqt-thread-replies >
.lqt_thread' ).each( function() {
$out.append(
$.thread_collapse.fn.getPreview( $( this ), depth + 1 ) );
} );
return $out;
@@ -52,7 +51,7 @@
// expand!
$thread
.removeClass(
'collapsed_thread' )
- .children()
+ .children( '.lqt-post-wrapper,
.lqt-thread-replies' )
.show()
.parent()
.children(
'.thread-collapsed-preview' )
@@ -63,7 +62,7 @@
if( $thread.children(
'.thread-collapsed-preview' ).size() > 0 ) {
$thread
.addClass(
'collapsed_thread' )
- .children()
+ .children(
'.lqt-post-wrapper, .lqt-thread-replies' )
.hide()
.end()
.children(
'.thread-collapsed-preview' )
@@ -86,7 +85,7 @@
.append(
$.thread_collapse.fn.getPreview( $thread, 0 ) );
// hide the other elements of
the thread, and append the collapsed preview
$thread
- .children()
+ .children(
'.lqt-post-wrapper, .lqt-thread-replies' )
.hide()
.end()
.addClass(
'collapsed_thread' )
--
To view, visit https://gerrit.wikimedia.org/r/36349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I520b0451d55f4eae2bbcf795c46f975b4b0af63b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Martineznovo <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: DaSch <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Martineznovo <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Werdna <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits