r59149 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59148‎ | r59149 | r59150 >
Date:21:34, 16 November 2009
Author:catrope
Status:deferred
Tags:
Comment:
usability: Merge r59048 (ClickTracking fix) and r59146 (partial; OptIn fix) from trunk to acaifix
Modified paths:
  • /branches/usability/acaifix/ClickTracking (modified) (history)
  • /branches/usability/acaifix/ClickTracking/SpecialClickTracking.php (modified) (history)
  • /branches/usability/acaifix/OptIn (modified) (history)
  • /branches/usability/acaifix/OptIn/SpecialOptIn.php (modified) (history)

Diff [purge]

Index: branches/usability/acaifix/OptIn/SpecialOptIn.php
@@ -66,6 +66,12 @@
6767
6868 $par = $wgRequest->getVal( 'from', $par );
6969 $this->mOriginTitle = Title::newFromText( $par );
 70+
 71+ // Verify that $this->mOriginTitle is not Special:Userlogout
 72+ if ( $this->mOriginTitle && $this->mOriginTitle->getNamespace() == NS_SPECIAL &&
 73+ SpecialPage::resolveAlias( $this->mOriginTitle->getText() ) == 'Userlogout' ) {
 74+ $this->mOriginTitle = null;
 75+ }
7076 if ( $this->mOriginTitle ) {
7177 $this->mOrigin = $this->mOriginTitle->getPrefixedDBKey();
7278 $this->mOriginQuery = $wgRequest->getVal( 'fromquery' );
@@ -93,17 +99,17 @@
94100 }
95101 else
96102 {
97 - if ( $wgRequest->getVal( 'opt' ) == 'in' )
98 - // Just opted in
 103+ if ( $wgRequest->getVal( 'opt' ) == 'in' && $wgUser->isLoggedIn() )
 104+ // Will be opted in in this request
99105 $wgOut->setPageTitle( wfMsg( 'optin-title-justoptedin' ) );
100106 else
101107 // About to opt in
102108 $wgOut->setPageTitle( wfMsg( 'optin-title-optedout' ) );
103109 }
104110
105 - if ( $wgRequest->getCheck( 'opt' ) ) {
 111+ if ( $wgRequest->getCheck( 'opt' ) && $wgUser->isLoggedIn() ) {
106112 if ( $wgRequest->getVal( 'opt' ) === 'in' ) {
107 - if ( self::checkToken() ) {
 113+ if ( self::checkToken() && !self::isOptedIn( $wgUser ) ) {
108114 self::optIn( $wgUser );
109115 $wgOut->addWikiMsg( 'optin-success-in' );
110116
@@ -117,21 +123,28 @@
118124 array( 'type' => $wgJsMimeType ),
119125 'js2AddOnloadHook( function() { $j.post( "' . $url . '", optInGetPOSTData() ); } );'
120126 ) );
 127+ } else if ( self::isOptedIn( $wgUser ) ) {
 128+ // User is already opted in but
 129+ // reloaded the page or tried to opt in
 130+ // again. Fake success
 131+ $wgOut->addWikiMsg( 'optin-success-in' );
121132 } else
 133+ // Token didn't match
122134 $this->showForm( self::isOptedIn( $wgUser ) ?
123135 'out' : 'in' );
124 - } else if ( $wgRequest->getVal( 'opt' ) == 'feedback' ) {
 136+ } else if ( $wgRequest->getVal( 'opt' ) == 'feedback' && self::isOptedIn( $wgUser ) ) {
125137 if ( $wgRequest->wasPosted() ) {
126138 $this->saveSurvey( $wgOptInFeedBackSurvey,
127139 'feedback' );
128140 $wgOut->addWikiMsg( 'optin-success-feedback' );
129141 } else
130142 $this->showForm( 'feedback' );
131 - } else if ( $wgRequest->getVal( 'opt' ) == 'browser' ) {
 143+ } else if ( $wgRequest->getVal( 'opt' ) == 'browser' && self::isOptedIn( $wgUser ) ) {
132144 $this->saveSurvey( $wgOptInBrowserSurvey, 'in' );
133145 $wgOut->disable();
134146 } else {
135 - if ( self::checkToken() ) {
 147+ // Opt out
 148+ if ( self::checkToken() && self::isOptedIn( $wgUser ) ) {
136149 self::optOut( $wgUser );
137150 $this->saveSurvey( $wgOptInSurvey, 'out' );
138151 $wgOut->addWikiMsg( 'optin-success-out' );
Property changes on: branches/usability/acaifix/OptIn/SpecialOptIn.php
___________________________________________________________________
Modified: svn:mergeinfo
139152 Merged /trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php:r59146
Property changes on: branches/usability/acaifix/OptIn
___________________________________________________________________
Added: svn:mergeinfo
140153 Merged /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:r51646
141154 Merged /trunk/extensions/UsabilityInitiative/OptIn:r56151-57234,58926,58973-58974,59146
142155 Merged /trunk/phase3/extensions/UsabilityInitiative/OptIn:r56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447
Index: branches/usability/acaifix/ClickTracking/SpecialClickTracking.php
@@ -494,12 +494,14 @@
495495 * @param maxTime max day (YYYYMMDD)
496496 * NOTE: once some of the constraints have been finalized, this will use more of the Database functions and not raw SQL
497497 */
498 - static function getTimeConstraintsStatement( $minTime, $maxTime ){
 498+ static function getTimeConstraintsStatement( $minTime, $maxTime ){
499499 if($minTime == 0 || $maxTime == 0){
500500 return '';
501501 }
502502 else {
503 -
 503+ //the dates are stored in the DB as MW_TIMESTAMP formats, add the zeroes to fix that
 504+ $minTime .= "000000";
 505+ $maxTime .= "000000";
504506 return "WHERE `action_time` >= '$minTime' AND `action_time` <= '$maxTime'";
505507 }
506508
Property changes on: branches/usability/acaifix/ClickTracking
___________________________________________________________________
Added: svn:mergeinfo
507509 Merged /branches/REL1_15/phase3/extensions/UsabilityInitiative/ClickTracking:r51646
508510 Merged /trunk/extensions/UsabilityInitiative/ClickTracking:r56151-57234,58926,58973-58974,59048
509511 Merged /trunk/phase3/extensions/UsabilityInitiative/ClickTracking:r56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59048add trailing zeroes for MW_TIMESTAMP formatnimishg02:00, 14 November 2009
r59146* OptIn: (bug 21508) Trying to opt in as an already opted-in user displays th...catrope21:05, 16 November 2009

Status & tagging log