*
* @private
* @param {string} info One of 'groups' or 'rights'
- * @param {Function} [callback]
* @return {jQuery.Promise}
*/
- function getUserInfo( info, callback ) {
+ function getUserInfo( info ) {
var api;
if ( !deferreds[info] ) {
}
- return deferreds[info].done( callback ).promise();
+ return deferreds[info].promise();
}
mw.user = user = {
seed = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
for ( i = 0; i < 32; i++ ) {
r = Math.floor( Math.random() * seed.length );
- id += seed.substring( r, r + 1 );
+ id += seed.charAt( r );
}
return id;
},
* @return {jQuery.Promise}
*/
getGroups: function ( callback ) {
- return getUserInfo( 'groups', callback );
+ return getUserInfo( 'groups' ).done( callback );
},
/**
* @return {jQuery.Promise}
*/
getRights: function ( callback ) {
- return getUserInfo( 'rights', callback );
+ return getUserInfo( 'rights' ).done( callback );
}
};
- /**
- * @method name
- * @inheritdoc #getName
- * @deprecated since 1.20 Use #getName instead
- */
- mw.log.deprecate( user, 'name', user.getName, 'Use mw.user.getName instead.' );
-
- /**
- * @method anonymous
- * @inheritdoc #isAnon
- * @deprecated since 1.20 Use #isAnon instead
- */
- mw.log.deprecate( user, 'anonymous', user.isAnon, 'Use mw.user.isAnon instead.' );
-
}( mediaWiki, jQuery ) );