Fix-ups to comments and User interface usages
* Use isRegistered() from the more narrow UserIdentity interface. * More specific type hints. * Remove comments that literally repeat the code. Change-Id: Icd0eaf8236be41b258efcf81d581540d2448e9e3
This commit is contained in:
@@ -67,7 +67,7 @@ class ApiULSSetLanguage extends ApiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
if ( $user->isAnon() ) {
|
if ( !$user->isRegistered() ) {
|
||||||
if ( $this->getConfig()->get( 'ULSAnonCanChangeLanguage' ) ) {
|
if ( $this->getConfig()->get( 'ULSAnonCanChangeLanguage' ) ) {
|
||||||
// Anonymous users can change language.
|
// Anonymous users can change language.
|
||||||
// Use a cookie that also can changed by JavaScript.
|
// Use a cookie that also can changed by JavaScript.
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ class Hooks implements
|
|||||||
$this->statsdDataFactory->increment( 'uls.setlang_used' );
|
$this->statsdDataFactory->increment( 'uls.setlang_used' );
|
||||||
|
|
||||||
$user = $out->getUser();
|
$user = $out->getUser();
|
||||||
if ( $user->isAnon() && !$out->getConfig()->get( 'ULSAnonCanChangeLanguage' ) ) {
|
if ( !$user->isRegistered() && !$out->getConfig()->get( 'ULSAnonCanChangeLanguage' ) ) {
|
||||||
// User is anon, and cannot change language, return.
|
// User is anon, and cannot change language, return.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ class Hooks implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $preferred
|
* @param float[] $preferred
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getDefaultLanguage( array $preferred ) {
|
protected function getDefaultLanguage( array $preferred ) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class ResourceLoaderULSModule extends ResourceLoaderModule {
|
|||||||
/**
|
/**
|
||||||
* Get all the dynamic data for the content language to an array.
|
* Get all the dynamic data for the content language to an array.
|
||||||
*
|
*
|
||||||
* @param string $languageCode Language code
|
* @param string $languageCode
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getData( $languageCode ) {
|
private function getData( $languageCode ) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Niklas Laxström
|
* @author Niklas Laxström
|
||||||
* @license GPL-2.0-or-later
|
* @license GPL-2.0-or-later
|
||||||
* @file
|
* @file
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Niklas Laxström
|
* @author Niklas Laxström
|
||||||
* @license GPL-2.0-or-later
|
* @license GPL-2.0-or-later
|
||||||
* @file
|
* @file
|
||||||
|
|||||||
Reference in New Issue
Block a user