http://www.mediawiki.org/wiki/Special:Code/MediaWiki/62160

Revision: 62160
Author:   werdna
Date:     2010-02-09 02:14:24 +0000 (Tue, 09 Feb 2010)

Log Message:
-----------
Merge r62158

Modified Paths:
--------------
    branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js

Property Changed:
----------------
    branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js       
2010-02-09 02:14:21 UTC (rev 62159)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js       
2010-02-09 02:14:24 UTC (rev 62160)
@@ -70,13 +70,17 @@
                return repliesElement;
        },
        
-       'checkEmptyReplies' : function( element ) {
+       'checkEmptyReplies' : function( element, action ) {
                var contents = element.contents();
                
                contents = 
contents.not('.lqt-replies-finish,.lqt-post-sep,.lqt-edit-form');
                
                if ( !contents.length ) {
-                       element.remove();
+                       if ( typeof action == 'undefined' || action == 'remove' 
) {
+                               element.remove();
+                       } else {
+                               element.hide();
+                       }
                }
        },
        
@@ -1234,18 +1238,23 @@
                
                setTimeout( function() { thread.draggable('destroy'); }, 1 );
                
-               // Now, let's do our updates
-               liquidThreads.confirmDragDrop( thread, params );
-               
+               // Remove drop points and schedule removal of empty replies 
elements.
+               var emptyChecks = [];
                $j('.lqt-drop-zone').each( function() {
                        var repliesHolder = 
$j(this).closest('.lqt-thread-replies');
                        
                        $j(this).remove();
                        
                        if (repliesHolder.length) {
-                               liquidThreads.checkEmptyReplies(repliesHolder);
+                               liquidThreads.checkEmptyReplies( repliesHolder, 
'hide' );
+                               emptyChecks = $j.merge( emptyChecks, 
repliesHolder );
                        }
                } );
+               
+               params.emptyChecks = emptyChecks;
+               
+               // Now, let's do our updates
+               liquidThreads.confirmDragDrop( thread, params );
        },
        
        'confirmDragDrop' : function( thread, params ) {
@@ -1352,6 +1361,12 @@
                var topLevel = (newParent == 'top');
                var wasTopLevel = thread.hasClass( 'lqt-thread-topmost' );
                
+               var doEmptyChecks = function() {
+                       $j.each( params.emptyChecks, function( k, element ) {
+                               liquidThreads.checkEmptyReplies( $j(element) );
+                       } );
+               };
+               
                var doneCallback =
                        function(data) {
                                // TODO error handling
@@ -1369,6 +1384,7 @@
                                
                                if (result != 'success') {
                                        alert( "Error: "+result );
+                                       doEmptyChecks();
                                        return;
                                }
                                
@@ -1393,7 +1409,6 @@
                                        var heading = 
$j('#lqt-header-'+threadId);
                                }
                                
-                               
                                // Assorted ways of returning a thread to its 
proper place.
                                if ( typeof params.insertAfter != 'undefined' ) 
{                                       
                                        // Move the heading             
@@ -1463,6 +1478,8 @@
                                if ( typeof callback == 'function' ) {
                                        callback();
                                }
+                               
+                               doEmptyChecks();
                        }
                
                if ( !topLevel || !wasTopLevel ) {


Property changes on: 
branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js
___________________________________________________________________
Added: svn:mergeinfo
   + /trunk/extensions/LiquidThreads/lqt.js:57390,58990-62113,62158



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to