Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/271141
Change subject: Drop NetSpeed cookie and associated preference
......................................................................
Drop NetSpeed cookie and associated preference
Since we decided to strip 'srcset' unconditionally, the NetSpeed cookie and its
associated preference are now redundant. So, remove them.
Change-Id: I7f74cb014a9d4587badddfc715ce906f4518a9a2
---
M i18n/en.json
M i18n/qqq.json
M includes/MobileContext.php
M includes/specials/SpecialMobileOptions.php
M tests/phpunit/MobileContextTest.php
5 files changed, 0 insertions(+), 76 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/41/271141/1
diff --git a/i18n/en.json b/i18n/en.json
index d43fd52..94056f3 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -301,7 +301,6 @@
"mobile-frontend-search-submit": "Go",
"mobile-frontend-settings-images-explain": "Load all image content that
appears in a page.",
"mobile-frontend-settings-beta": "Beta",
- "mobile-frontend-settings-lowres": "Data saving",
"mobile-frontend-settings-site-description": "{{SITENAME}} is available
in $1 {{PLURAL:$1|language|languages}}. All available versions are listed
below",
"mobile-frontend-settings-site-header": "{{SITENAME}} Languages",
"mobile-frontend-sign-in-error-heading": "Whoops",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 41484b5..5e12e7c 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -299,7 +299,6 @@
"mobile-frontend-search-submit": "Label for the button near the search
box.\n{{Identical|Go}}",
"mobile-frontend-settings-images-explain": "Short description on
[[Special:MobileOptions]], that the user can enable or disable images with this
option.",
"mobile-frontend-settings-beta": "Text for beta on settings
page.\n{{Identical|Beta}}",
- "mobile-frontend-settings-lowres": "Text for data saving option on
settings page. \"Saving\" means \"economy\", as in \"saving money (on data
connection)\", not \"saving files\".",
"mobile-frontend-settings-site-description": "Shown on
[[Special:MobileOptions]]. Parameters:\n* $1 - the number of other language
versions for this wiki",
"mobile-frontend-settings-site-header": "Heading for the
Special:MobileOptions/Language page - only visible to non JavaScript users",
"mobile-frontend-sign-in-error-heading": "Heading for when an error
occurred. You can translate \"Error\" instead.",
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 90d9a96..d266a77 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -10,9 +10,6 @@
const USEFORMAT_COOKIE_NAME = 'mf_useformat';
const USER_MODE_PREFERENCE_NAME = 'mfMode';
- const NETSPEED_FAST = 'A';
- const NETSPEED_SLOW = 'B';
-
/**
* Saves the testing mode user has opted in: 'beta' or 'stable'
* @var string $mobileMode
@@ -23,11 +20,6 @@
* @var boolean $disableImages
*/
protected $disableImages;
- /**
- * NetSpeed designation
- * @var string $netSpeed
- */
- protected $netSpeed;
/**
* Save explicitly requested format
* @var string $useFormat
@@ -178,34 +170,6 @@
}
return $this->disableImages;
- }
-
- /**
- * Get NetSpeed designation.
- * @return string MobileContext::NETSPEED_FAST or
MobileContext::NETSPEED_SLOW.
- */
- public function getNetSpeed() {
- if ( is_null( $this->netSpeed ) ) {
- $this->netSpeed = $this->getRequest()->getCookie(
'NetSpeed', '' );
- if ( $this->netSpeed !== self::NETSPEED_FAST &&
$this->netSpeed !== self::NETSPEED_SLOW ) {
- // Since we are currently delivering the
richest experience
- // to all users, make the default netSpeed
'fast'.
- $this->netSpeed = self::NETSPEED_FAST;
- }
- }
-
- return $this->netSpeed;
- }
-
- /**
- * Set NetSpeed designation.
- * @param string $value of net speed. Currently accepts
self::NETSPEED_FAST
- * or self::NETSPEED_SLOW
- */
- public function setNetSpeed( $value ) {
- $this->netSpeed = $value;
- $this->getRequest()->response()
- ->setCookie( 'NetSpeed', $this->netSpeed, 0, array(
'prefix' => '' ) );
}
/**
diff --git a/includes/specials/SpecialMobileOptions.php
b/includes/specials/SpecialMobileOptions.php
index c565dd1..ff51c9a 100644
--- a/includes/specials/SpecialMobileOptions.php
+++ b/includes/specials/SpecialMobileOptions.php
@@ -114,13 +114,6 @@
'id' => 'enable-images-toggle',
);
- $options['lowres'] = array(
- 'checked' => $context->getNetSpeed() ===
MobileContext::NETSPEED_SLOW ? 'checked' : '',
- 'label' => $this->msg(
'mobile-frontend-settings-lowres' )->text(),
- 'description' => $this->msg(
'mobile-frontend-low-res-explain' )->text(),
- 'name' => 'enableLowResImages',
- );
-
// beta settings
if ( $this->getMFConfig()->get( 'MFEnableBeta' ) ) {
$options['beta'] = array(
diff --git a/tests/phpunit/MobileContextTest.php
b/tests/phpunit/MobileContextTest.php
index dbe226d..4dfc4fd 100644
--- a/tests/phpunit/MobileContextTest.php
+++ b/tests/phpunit/MobileContextTest.php
@@ -611,37 +611,6 @@
SpecialPage::getTitleFor( 'Search' );
$this->assertTrue( true, 'In case of failure this test just
crashes' );
}
-
- public function getNetSpeedProvider() {
- return array(
- array(
- array( 'NetSpeed' =>
MobileContext::NETSPEED_FAST ),
- MobileContext::NETSPEED_FAST
- ),
- array(
- array( 'NetSpeed' =>
MobileContext::NETSPEED_SLOW ),
- MobileContext::NETSPEED_SLOW
- ),
- array(
- array(),
- MobileContext::NETSPEED_FAST,
- 'If NetSpeed cookie is absent, default to
MobileContext::NETSPEED_FAST'
- ),
- array(
- array( 'NetSpeed' => 'Bogus value' ),
- MobileContext::NETSPEED_FAST,
- 'If NetSpeed cookie value is invalid, default
to MobileContext::NETSPEED_FAST'
- ),
- );
- }
-
- /**
- * @dataProvider getNetSpeedProvider
- */
- public function testGetNetSpeed( $cookies, $netSpeed, $message = null )
{
- $context = $this->makeContext( '/', $cookies );
- $this->assertEquals( $context->getNetSpeed(), $netSpeed,
$message );
- }
}
class BogusMobileContext {
--
To view, visit https://gerrit.wikimedia.org/r/271141
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f74cb014a9d4587badddfc715ce906f4518a9a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits