mediawiki.user: Use then() instead of done()
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 29 Mar 2019 18:36:48 +0000 (18:36 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 29 Mar 2019 20:12:37 +0000 (20:12 +0000)
Makes it compatible with standard ES6 Promise, and also
allows the browser to respond sooner to user input (if there was
any) rather than (synchronously) continuing within this same async
block.

Change-Id: I82aac439cecd7680f53a82649196c9168eda6755

resources/src/mediawiki.user.js

index d9b1227..aada50c 100644 (file)
                        var userGroups = mw.config.get( 'wgUserGroups', [] );
 
                        // Uses promise for backwards compatibility
-                       return $.Deferred().resolve( userGroups ).done( callback );
+                       return $.Deferred().resolve( userGroups ).then( callback );
                },
 
                /**
                        return getUserInfo().then(
                                function ( userInfo ) { return userInfo.rights; },
                                function () { return []; }
-                       ).done( callback );
+                       ).then( callback );
                }
        } );