[MediaWiki-commits] [Gerrit] Fix disable Images via Special:MobileOptions - change (mediawiki...MobileFrontend)

2015-07-28 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fix disable Images via Special:MobileOptions
..


Fix disable Images via Special:MobileOptions

A check, if a checkbox was set, or not doesn't make sense, the browser
normally omit's the checkbox value if unchecked and no special value
given. That means, that an unchecked checkbox for disabled Images would
be interpreted as "Nothing changed, go ahead!" without changing the
value.

Remove this check to enable the disable image setting again and work
around T98187 by explicitly send the current state, if images are disabled
or not, in BetaOptin panel.

Follow up: Ifef83b8fa369f19f9a9d6eb4ab2164271104f8ea

Bug: T106749
Change-Id: I7988eb892397d7430c0f51181d2d6a3af06d804e
---
M includes/specials/SpecialMobileOptions.php
M resources/mobile.betaoptin/BetaOptinPanel.js
M resources/mobile.betaoptin/Panel.hogan
3 files changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialMobileOptions.php 
b/includes/specials/SpecialMobileOptions.php
index 9c5ccce..a6077db 100644
--- a/includes/specials/SpecialMobileOptions.php
+++ b/includes/specials/SpecialMobileOptions.php
@@ -270,13 +270,11 @@
}
$context->setMobileMode( $group );
$imagesDisabled = !$request->getBool( 'enableImages' );
-   if ( $request->getVal( 'enableImages' ) !== null ) {
-   if ( $context->imagesDisabled() !== $imagesDisabled ) {
-   // Only record when the state has changed
-   $schemaData['images'] = $imagesDisabled ? "off" 
: "on";
-   }
-   $context->setDisableImagesCookie( $imagesDisabled );
+   if ( $context->imagesDisabled() !== $imagesDisabled ) {
+   // Only record when the state has changed
+   $schemaData['images'] = $imagesDisabled ? "off" : "on";
}
+   $context->setDisableImagesCookie( $imagesDisabled );
 
$returnToTitle = Title::newFromText( $request->getText( 
'returnto' ) );
if ( $returnToTitle ) {
diff --git a/resources/mobile.betaoptin/BetaOptinPanel.js 
b/resources/mobile.betaoptin/BetaOptinPanel.js
index a73c73a..22cf691 100644
--- a/resources/mobile.betaoptin/BetaOptinPanel.js
+++ b/resources/mobile.betaoptin/BetaOptinPanel.js
@@ -17,6 +17,7 @@
defaults: {
postUrl: undefined,
editToken: mw.user.tokens.get( 'editToken' ),
+   enableImages: mw.config.get( 'wgImagesDisabled' ) ? 0 : 
1,
text: mw.msg( 'mobile-frontend-panel-betaoptin-msg' ),
buttons: [
new Button( {
diff --git a/resources/mobile.betaoptin/Panel.hogan 
b/resources/mobile.betaoptin/Panel.hogan
index 00589a3..7e9d7de 100644
--- a/resources/mobile.betaoptin/Panel.hogan
+++ b/resources/mobile.betaoptin/Panel.hogan
@@ -1,6 +1,7 @@
 
{{text}}

+   

{{#buttons}}{{>button}}{{/buttons}}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/226737
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7988eb892397d7430c0f51181d2d6a3af06d804e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow 
Gerrit-Reviewer: BarryTheBrowserTestBot 
Gerrit-Reviewer: Florianschmidtwelzow 
Gerrit-Reviewer: Frankiebot 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix disable Images via Special:MobileOptions - change (mediawiki...MobileFrontend)

2015-07-24 Thread Florianschmidtwelzow (Code Review)
Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226737

Change subject: Fix disable Images via Special:MobileOptions
..

Fix disable Images via Special:MobileOptions

A check, if a checkbox was set, or not doesn't make sense, the browser
normally omit's the checkbox value if unchecked and no special value
given. That means, that an unchecked checkbox for disabled Images would
be interpreted as "Nothing changed, go ahead!" without changing the
value.

Remove this check to enable the disable image setting again and work
around T98187 by explicitly send the current state, if images are disabled
or not, in BetaOptin panel.

Follow up: Ifef83b8fa369f19f9a9d6eb4ab2164271104f8ea

Bug: T106749
Change-Id: I7988eb892397d7430c0f51181d2d6a3af06d804e
---
M includes/specials/SpecialMobileOptions.php
M resources/mobile.betaoptin/BetaOptinPanel.js
M resources/mobile.betaoptin/Panel.hogan
M resources/skins.minerva.scripts/init.js
4 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/37/226737/1

diff --git a/includes/specials/SpecialMobileOptions.php 
b/includes/specials/SpecialMobileOptions.php
index 9c5ccce..a6077db 100644
--- a/includes/specials/SpecialMobileOptions.php
+++ b/includes/specials/SpecialMobileOptions.php
@@ -270,13 +270,11 @@
}
$context->setMobileMode( $group );
$imagesDisabled = !$request->getBool( 'enableImages' );
-   if ( $request->getVal( 'enableImages' ) !== null ) {
-   if ( $context->imagesDisabled() !== $imagesDisabled ) {
-   // Only record when the state has changed
-   $schemaData['images'] = $imagesDisabled ? "off" 
: "on";
-   }
-   $context->setDisableImagesCookie( $imagesDisabled );
+   if ( $context->imagesDisabled() !== $imagesDisabled ) {
+   // Only record when the state has changed
+   $schemaData['images'] = $imagesDisabled ? "off" : "on";
}
+   $context->setDisableImagesCookie( $imagesDisabled );
 
$returnToTitle = Title::newFromText( $request->getText( 
'returnto' ) );
if ( $returnToTitle ) {
diff --git a/resources/mobile.betaoptin/BetaOptinPanel.js 
b/resources/mobile.betaoptin/BetaOptinPanel.js
index a73c73a..22cf691 100644
--- a/resources/mobile.betaoptin/BetaOptinPanel.js
+++ b/resources/mobile.betaoptin/BetaOptinPanel.js
@@ -17,6 +17,7 @@
defaults: {
postUrl: undefined,
editToken: mw.user.tokens.get( 'editToken' ),
+   enableImages: mw.config.get( 'wgImagesDisabled' ) ? 0 : 
1,
text: mw.msg( 'mobile-frontend-panel-betaoptin-msg' ),
buttons: [
new Button( {
diff --git a/resources/mobile.betaoptin/Panel.hogan 
b/resources/mobile.betaoptin/Panel.hogan
index 00589a3..7e9d7de 100644
--- a/resources/mobile.betaoptin/Panel.hogan
+++ b/resources/mobile.betaoptin/Panel.hogan
@@ -1,6 +1,7 @@
 
{{text}}

+   

{{#buttons}}{{>button}}{{/buttons}}
 
diff --git a/resources/skins.minerva.scripts/init.js 
b/resources/skins.minerva.scripts/init.js
index b82e59b..c247cc3 100644
--- a/resources/skins.minerva.scripts/init.js
+++ b/resources/skins.minerva.scripts/init.js
@@ -116,7 +116,7 @@
// a single character has 16 possibilities so this is 1/16 
6.25% chance (a-f and 0-9)
// 3% chance of this happening
inSample = $.inArray( token.charAt( 0 ), [ '3' ] ) !== -1;
-   if ( inStable && ( inSample || mw.util.getParamValue( 'debug' ) 
) ) {
+   //if ( inStable && ( inSample || mw.util.getParamValue( 'debug' 
) ) ) {
new BetaOptinPanel( {
postUrl: mw.util.getUrl( 
'Special:MobileOptions', {
returnto: page.title
@@ -126,6 +126,6 @@
settings.save( 
'mobile-betaoptin-token', '~' );
} )
.appendTo( 
M.getCurrentPage().getLeadSectionElement() );
-   }
+   //}
}
 }( mw.mobileFrontend, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/226737
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7988eb892397d7430c0f51181d2d6a3af06d804e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.