r72127 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72126‎ | r72127 | r72128 >
Date:17:52, 1 September 2010
Author:catrope
Status:deferred
Tags:
Comment:
1.16wmf4: Merge r70633, r72043, r72055, r72059 from trunk
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.i18n.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php (modified) (history)
  • /branches/wmf/1.16wmf4/skins/Vector.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/skins/Vector.php
@@ -93,11 +93,11 @@
9494
9595 // Adds namespace links
9696 $links['namespaces'][$subjectId] = $this->tabAction(
97 - $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true
 97+ $subjectPage, 'nstab-' . $subjectId, !$isTalk, '', true
9898 );
9999 $links['namespaces'][$subjectId]['context'] = 'subject';
100100 $links['namespaces'][$talkId] = $this->tabAction(
101 - $talkPage, 'vector-namespace-talk', $isTalk, '', true
 101+ $talkPage, 'talk', $isTalk, '', true
102102 );
103103 $links['namespaces'][$talkId]['context'] = 'talk';
104104
@@ -299,7 +299,7 @@
300300 } else {
301301 $links['namespaces']['special'] = array(
302302 'class' => 'selected',
303 - 'text' => wfMsg( 'vector-namespace-special' ),
 303+ 'text' => wfMsg( 'nstab-special' ),
304304 'href' => $wgRequest->getRequestURL()
305305 );
306306 }
Property changes on: branches/wmf/1.16wmf4/skins/Vector.php
___________________________________________________________________
Modified: svn:mergeinfo
307307 Merged /trunk/phase3/skins/Vector.php:r72055,72059
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.i18n.php
@@ -25,6 +25,7 @@
2626 'prefswitch-survey-question-dislike' => 'What did you dislike about the features?',
2727 'prefswitch-survey-question-whyoff' => 'Why are you turning off the new features?
2828 Please select all that apply.',
 29+ 'prefswitch-survey-question-globaloff' => 'Do you want the features turned off globally?',
2930 'prefswitch-survey-answer-whyoff-hard' => 'The features were too hard to use.',
3031 'prefswitch-survey-answer-whyoff-didntwork' => 'The features did not function properly.',
3132 'prefswitch-survey-answer-whyoff-notpredictable' => 'The features did not perform predictably.',
@@ -62,6 +63,7 @@
6364 'prefswitch-survey-answer-os-ios' => 'iOS',
6465 'prefswitch-survey-answer-os-linux' => 'Linux',
6566 'prefswitch-survey-answer-os-other' => 'Other operating system:',
 67+ 'prefswitch-survey-answer-globaloff-yes' => 'Yes, turn the features off on all wikis',
6668 'prefswitch-survey-question-res' => 'What is the resolution of your screen?',
6769 'prefswitch-title-on' => 'New features',
6870 'prefswitch-title-switched-on' => 'Enjoy!',
@@ -158,6 +160,7 @@
159161 'prefswitch-main-feedback' => 'Entry asking for feedback in a local page.',
160162 'prefswitch-main-anon' => 'Is used on Special:UsabilityInitiativePrefSwitch at Wikimedia.org.',
161163 'prefswitch-feedbackpage' => '{{doc-important|The name of the user experience feedback page on this wiki. Should only be translated for ja, es, de, fr, it, ru, pl, pt, nl for now. Do not translate "Project:"}}',
 164+ 'prefswitch-survey-submit-global-off' => 'This message may still change',
162165 );
163166
164167 /** Afrikaans (Afrikaans)
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.php
@@ -38,6 +38,9 @@
3939 ),
4040 );
4141
 42+// Allow global opt-outs. Depends on CentralAuth
 43+$wgPrefSwitchGlobalOptOut = false;
 44+
4245 // Survey questions to ask when users switch prefs
4346 // array(
4447 // survey-id => array(
@@ -144,6 +147,15 @@
145148 }
146149 unset( $survey );
147150
 151+// Question for global opt out
 152+$wgPrefSwitchSurveys['off']['questions']['global'] = array(
 153+ 'question' => 'prefswitch-survey-question-globaloff',
 154+ 'type' => 'checks',
 155+ 'answers' => array(
 156+ 'yes' => 'prefswitch-survey-answer-globaloff-yes',
 157+ ),
 158+);
 159+
148160 /* Setup */
149161
150162 // Credits
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php
@@ -67,10 +67,30 @@
6868 $user->saveSettings();
6969 }
7070 /**
71 - * Switches a user's prefernces off
 71+ * Switches a user's preferences off
7272 * @param $user User object to set preferences for
 73+ * @param $global bool Whether to apply this change on all wikis in $wgPrefSwitchWikis
7374 */
74 - public static function switchOff( $user ) {
 75+ public static function switchOff( $user, $global = false ) {
 76+ self::switchOffUser( $user );
 77+ if ( $global ) {
 78+ $globalUser = new CentralAuthUser( $user->getName() );
 79+ if ( !$globalUser->exists() ) {
 80+ return;
 81+ }
 82+ $accounts = $globalUser->queryAttached();
 83+ foreach ( $accounts as $account ) {
 84+ $remoteUser = UserRightsProxy::newFromName(
 85+ $account['wiki'],
 86+ $globalUser->getName(),
 87+ true
 88+ );
 89+ self::switchOffUser( $remoteUser );
 90+ }
 91+ }
 92+ }
 93+
 94+ private static function switchOffUser( $user ) {
7595 global $wgPrefSwitchPrefs;
7696 foreach ( $wgPrefSwitchPrefs['off'] as $pref => $value ) {
7797 $user->setOption( $pref, $value );
@@ -85,7 +105,7 @@
86106 wfLoadExtensionMessages( 'PrefSwitch' );
87107 }
88108 public function execute( $par ) {
89 - global $wgRequest, $wgOut, $wgUser, $wgPrefSwitchSurveys, $wgPrefSwitchStyleVersion;
 109+ global $wgRequest, $wgOut, $wgUser, $wgPrefSwitchSurveys, $wgPrefSwitchStyleVersion, $wgPrefSwitchGlobalOptOut;
90110 // Get the origin from the request
91111 $par = $wgRequest->getVal( 'from', $par );
92112 $this->originTitle = Title::newFromText( $par );
@@ -126,7 +146,7 @@
127147 case 'off':
128148 // Switch off
129149 if ( self::checkToken() && self::isSwitchedOn( $wgUser ) && $wgRequest->wasPosted() ) {
130 - self::switchOff( $wgUser );
 150+ self::switchOff( $wgUser, $wgPrefSwitchGlobalOptOut && in_array( 'yes', $wgRequest->getArray( 'prefswitch-survey-global', array() ) ) );
131151 PrefSwitchSurvey::save( 'off', $wgPrefSwitchSurveys['feedback'] );
132152 $wgOut->addWikiMsg( 'prefswitch-success-off' );
133153 } else if ( !self::isSwitchedOn( $wgUser ) ) {
@@ -199,7 +219,7 @@
200220 /* Private Functions */
201221
202222 private function render( $mode = null ) {
203 - global $wgUser, $wgOut, $wgPrefSwitchSurveys, $wgAllowUserCss, $wgAllowUserJs;
 223+ global $wgUser, $wgOut, $wgPrefSwitchSurveys, $wgPrefSwitchGlobalOptOut, $wgAllowUserCss, $wgAllowUserJs;
204224 // Make sure links will retain the origin
205225 $query = array( 'from' => $this->origin, 'fromquery' => $this->originQuery );
206226 if ( isset( $wgPrefSwitchSurveys[$mode] ) ) {
Property changes on: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch
___________________________________________________________________
Modified: svn:mergeinfo
207227 Merged /trunk/extensions/UsabilityInitiative/PrefSwitch:r70633,72043

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70633PrefSwitch: Make global opt-outs possible, using CentralAuth to determine whi...catrope16:13, 7 August 2010
r72043PrefSwitch: Reorganize global opt-out as a checkbox per Brandon. The implemen...catrope20:13, 31 August 2010
r72055Fix for bug 24906adam21:52, 31 August 2010
r72059follow up to r72055 - fixing the discussion tabadam22:41, 31 August 2010

Status & tagging log