Update usages of user module to mw.user

We are deprecating the MobileFrontend user module. Use the
mw.user module in core instead which supports the same methods.

Bug: T204866
Change-Id: I3d068198ab79fe85823a9d82ef4bd7ca07013d3b
This commit is contained in:
jdlrobson 2018-11-21 11:12:41 -08:00
parent 6a7d350160
commit e1b94f3f63
3 changed files with 8 additions and 6 deletions

View file

@ -7,7 +7,8 @@ mw.loader.using( [
'ext.eventLogging.subscriber'
] ).then( function () {
var M = mw.mobileFrontend,
user = M.require( 'mobile.startup/user' ),
user = mw.user,
editCount = mw.config.get( 'wgUserEditCount' ),
// Schema provided by ext.eventLogging.subscriber class
Schema = mw.eventLog.Schema, // resource-modules-disable-line
context = M.require( 'mobile.startup/context' ),
@ -37,7 +38,8 @@ mw.loader.using( [
{
mobileMode: context.getMode(),
username: user.getName() || undefined,
userEditCount: typeof user.getEditCount() === 'number' ? user.getEditCount() : undefined
// FIXME: Use edit bucket here (T210106)
userEditCount: typeof editCount === 'number' ? editCount : undefined
}
);

View file

@ -3,7 +3,7 @@
var loader = M.require( 'mobile.startup/rlModuleLoader' ),
features = mw.config.get( 'wgMinervaFeatures', {} ),
overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ),
user = M.require( 'mobile.startup/user' );
isAnon = mw.user.isAnon();
// check the categories feature has been turned on
if ( !features.categories ) {
@ -21,7 +21,7 @@
loadingOverlay.hide();
return new CategoryOverlay( {
api: new mw.Api(),
isAnon: user.isAnon(),
isAnon: isAnon,
title: M.getCurrentPage().title
} );
} );
@ -35,7 +35,7 @@
loadingOverlay.hide();
return new CategoryAddOverlay( {
api: new mw.Api(),
isAnon: user.isAnon(),
isAnon: isAnon,
title: M.getCurrentPage().title
} );
} );

View file

@ -1,7 +1,7 @@
( function ( M ) {
var Watchstar = M.require( 'mobile.watchstar/Watchstar' ),
user = M.require( 'mobile.startup/user' );
user = mw.user;
/**
* Toggle the watch status of a known page