diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /includes/resourceloader/ResourceLoaderUserTokensModule.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/resourceloader/ResourceLoaderUserTokensModule.php')
-rw-r--r-- | includes/resourceloader/ResourceLoaderUserTokensModule.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/includes/resourceloader/ResourceLoaderUserTokensModule.php b/includes/resourceloader/ResourceLoaderUserTokensModule.php index 668467ca..ccd1dfd0 100644 --- a/includes/resourceloader/ResourceLoaderUserTokensModule.php +++ b/includes/resourceloader/ResourceLoaderUserTokensModule.php @@ -37,15 +37,16 @@ class ResourceLoaderUserTokensModule extends ResourceLoaderModule { /** * Fetch the tokens for the current user. * + * @param ResourceLoaderContext $context * @return array List of tokens keyed by token type */ - protected function contextUserTokens() { - global $wgUser; + protected function contextUserTokens( ResourceLoaderContext $context ) { + $user = $context->getUserObj(); return array( - 'editToken' => $wgUser->getEditToken(), - 'patrolToken' => $wgUser->getEditToken( 'patrol' ), - 'watchToken' => $wgUser->getEditToken( 'watch' ), + 'editToken' => $user->getEditToken(), + 'patrolToken' => $user->getEditToken( 'patrol' ), + 'watchToken' => $user->getEditToken( 'watch' ), ); } @@ -55,7 +56,7 @@ class ResourceLoaderUserTokensModule extends ResourceLoaderModule { */ public function getScript( ResourceLoaderContext $context ) { return Xml::encodeJsCall( 'mw.user.tokens.set', - array( $this->contextUserTokens() ), + array( $this->contextUserTokens( $context ) ), ResourceLoader::inDebugMode() ); } |