mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-09-24 02:39:20 +00:00
Allow languageinheader
query param to fully control treatment of languages
Before this commit the `languageinheader` query param would only take effect if the A/B test was enabled AND the query param was set. Per T282543, we want the query param to take effect regardless of the state of the language/AB test config. To see new treatment, set `languageinheader=1`. To see old treatment, set `languageinheader=0`. Bug: T282543 Change-Id: I6a06e90b6e46a6fd7506a5ddeaf071b893ebfe8e
This commit is contained in:
parent
50430ea06a
commit
de5a640c0b
|
@ -91,15 +91,14 @@ final class LanguageInHeaderTreatmentRequirement implements Requirement {
|
|||
* @throws \ConfigException
|
||||
*/
|
||||
public function isMet() : bool {
|
||||
if ( $this->request->getCheck( Constants::QUERY_PARAM_LANGUAGE_IN_HEADER ) ) {
|
||||
return $this->request->getBool( Constants::QUERY_PARAM_LANGUAGE_IN_HEADER );
|
||||
}
|
||||
|
||||
if (
|
||||
(bool)$this->config->get( Constants::CONFIG_LANGUAGE_IN_HEADER_TREATMENT_AB_TEST ) &&
|
||||
$this->user->isRegistered()
|
||||
) {
|
||||
|
||||
if ( $this->request->getCheck( Constants::QUERY_PARAM_LANGUAGE_IN_HEADER ) ) {
|
||||
return $this->request->getBool( Constants::QUERY_PARAM_LANGUAGE_IN_HEADER );
|
||||
}
|
||||
|
||||
$id = null;
|
||||
if ( $this->centralIdLookup ) {
|
||||
$id = $this->centralIdLookup->centralIdFromLocalUser( $this->user );
|
||||
|
|
|
@ -234,6 +234,38 @@ class LanguageInHeaderTreatmentRequirementTest extends \MediaWikiUnitTestCase {
|
|||
false,
|
||||
'Even logged in users get old treatment when A/B test enabled and query param set to "0"'
|
||||
],
|
||||
[
|
||||
// Is language enabled
|
||||
[
|
||||
'logged_in' => false,
|
||||
'logged_out' => false,
|
||||
],
|
||||
// is A-B test enabled
|
||||
false,
|
||||
1,
|
||||
// use central id lookup?
|
||||
false,
|
||||
// `languageinheader` query param
|
||||
"1",
|
||||
true,
|
||||
'Users get new treatment when query param set to "1" regardless of state of A/B test or config flags'
|
||||
],
|
||||
[
|
||||
// Is language enabled
|
||||
[
|
||||
'logged_in' => false,
|
||||
'logged_out' => false,
|
||||
],
|
||||
// is A-B test enabled
|
||||
false,
|
||||
1,
|
||||
// use central id lookup?
|
||||
false,
|
||||
// `languageinheader` query param
|
||||
"0",
|
||||
false,
|
||||
'Users get old treatment when query param set to "0" regardless of state of A/B test or config flags'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue