r98179 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98178‎ | r98179 | r98180 >
Date:21:38, 26 September 2011
Author:aaron
Status:ok (Comments)
Tags:lamecommitsummary 
Comment:
FU r97886:
* JS fixes for bad object -> bool casting and binding that overrides anything else.
* Redid JS messages to avoid html injection. Kind of hacky work-around for no rawParams() method.
* Removed wgUserName param from messages (YAGNI).
* Don't show "you are reviewing" notice without JS enabled (the JS links are broken in that case). The "advertise(d) as reviewing" toggle is all JS.
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/RevisionReviewFormUI.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/language/RevisionReview.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/modules/review.js (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -390,7 +390,8 @@
391391 'revreview-submit-reviewed', 'revreview-submit-unreviewed',
392392 'revreview-submitting', 'actioncomplete', 'actionfailed',
393393 'revreview-adv-reviewing-p', 'revreview-adv-reviewing-c',
394 - 'revreview-sadv-reviewing-p', 'revreview-sadv-reviewing-c'
 394+ 'revreview-sadv-reviewing-p', 'revreview-sadv-reviewing-c',
 395+ 'revreview-adv-start-link', 'revreview-adv-stop-link'
395396 ),
396397 'dependencies' => array( 'mediawiki.util' ),
397398 'localBasePath' => $localModulePath,
Index: trunk/extensions/FlaggedRevs/presentation/language/RevisionReview.i18n.php
@@ -65,10 +65,12 @@
6666 'revreview-successful2' => '\'\'\'Revision of [[:$1|$1]] successfully unflagged.\'\'\'',
6767 'revreview-poss-conflict-p' => '\'\'\'Warning: [[User:$1|$1]] started reviewing this page on $2 at $3.\'\'\'',
6868 'revreview-poss-conflict-c' => '\'\'\'Warning: [[User:$1|$1]] started reviewing these changes on $2 at $3.\'\'\'',
69 - 'revreview-adv-reviewing-p' => '<span class="fr-under-review">Notice: Other reviewers can see that you are reviewing this page.</span> (<a id="mw-fr-reviewing-stop" href="javascript:void(0)">de-advertise</a>)',
70 - 'revreview-adv-reviewing-c' => '<span class="fr-under-review">Notice: Other reviewers can see that you are reviewing these changes.</span> (<a id="mw-fr-reviewing-stop" href="javascript:void(0)">de-advertise</a>)',
71 - 'revreview-sadv-reviewing-p' => 'You can <a id="mw-fr-reviewing-start" href="javascript:void(0)">advertise</a> yourself as reviewing this page to other users.',
72 - 'revreview-sadv-reviewing-c' => 'You can <a id="mw-fr-reviewing-start" href="javascript:void(0)">advertise</a> yourself as reviewing these changes to other users.',
 69+ 'revreview-adv-reviewing-p' => 'Notice: Other reviewers can see that you are reviewing this page.',
 70+ 'revreview-adv-reviewing-c' => 'Notice: Other reviewers can see that you are reviewing these changes.',
 71+ 'revreview-sadv-reviewing-p' => 'You can $1 yourself as reviewing this page to other users.',
 72+ 'revreview-sadv-reviewing-c' => 'You can $1 yourself as reviewing these changes to other users.',
 73+ 'revreview-adv-start-link' => 'advertise',
 74+ 'revreview-adv-stop-link' => 'de-advertise',
7375 'revreview-toolow' => '\'\'\'You must rate each of the attributes higher than "inadequate" in order for a revision to be considered reviewed.\'\'\'
7476
7577 To remove the review status of a revision, click "unaccept".
Index: trunk/extensions/FlaggedRevs/presentation/RevisionReviewFormUI.php
@@ -143,25 +143,18 @@
144144 list( $u, $ts ) = FRUserActivity::getUserReviewingPage( $this->rev->getPage() );
145145 }
146146 $form .= "<p>";
147 - if ( $u !== null ) { // page under review...
148 - if ( $u != $this->user->getName() ) { // by another user...
149 - $form .= '<span class="fr-under-review">';
150 - $msg = $priorRevId
151 - ? 'revreview-poss-conflict-c'
152 - : 'revreview-poss-conflict-p';
153 - $form .= wfMsgExt( $msg, 'parseinline',
154 - $u, $wgLang->date( $ts, true ), $wgLang->time( $ts, true ) );
155 - $form .= "</span>";
156 - } else { // by this user...
157 - $form .= '<span id="mw-fr-reviewing-status">'; // JS widget
158 - $msg = $priorRevId
159 - ? 'revreview-adv-reviewing-c'
160 - : 'revreview-adv-reviewing-p';
161 - $form .= wfMsg( $msg ); // don't escape
162 - $form .= "</span>";
163 - }
164 - } else { // page not under review; add JS widget
165 - $form .= '<span id="mw-fr-reviewing-status" style="display:none;"></span>';
 147+ // Page under review (and not by this user)...
 148+ if ( $u !== null && $u != $this->user->getName() ) {
 149+ $form .= '<span class="fr-under-review">';
 150+ $msg = $priorRevId
 151+ ? 'revreview-poss-conflict-c'
 152+ : 'revreview-poss-conflict-p';
 153+ $form .= wfMsgExt( $msg, 'parseinline',
 154+ $u, $wgLang->date( $ts, true ), $wgLang->time( $ts, true ) );
 155+ $form .= "</span>";
 156+ // Page not under review or under review by this user...
 157+ } else {
 158+ $form .= '<span id="mw-fr-reviewing-status" style="display:none;"></span>'; // JS widget
166159 }
167160 $form .= "</p>\n";
168161
Index: trunk/extensions/FlaggedRevs/presentation/modules/review.js
@@ -346,12 +346,21 @@
347347 return; // failed
348348 }
349349 }
350 - // Update notice to say that user is advertising...
351 - var msgkey = $('#mw-fr-input-refid')
 350+ // Build notice to say that user is advertising...
 351+ var msgkey = $('#mw-fr-input-refid').length
352352 ? 'revreview-adv-reviewing-c' // diff
353353 : 'revreview-adv-reviewing-p' // page
354 - $('#mw-fr-reviewing-status').html( mw.msg( msgkey, [mw.config.get('wgUserName')] ) );
355 - $('#mw-fr-reviewing-stop').click( FlaggedRevsReview.deadvertiseReviewing );
 354+ var $underReview = $(
 355+ '<span class="fr-under-review">' + mw.message( msgkey ).escaped() + '</span>' );
 356+ // Update notice to say that user is advertising...
 357+ $('#mw-fr-reviewing-status')
 358+ .empty()
 359+ .append( $underReview )
 360+ .append( ' (' + mw.html.element( 'a',
 361+ { id: 'mw-fr-reviewing-stop' }, mw.msg( 'revreview-adv-stop-link' ) ) + ')' )
 362+ .find( '#mw-fr-reviewing-stop')
 363+ .css( 'cursor', 'pointer' )
 364+ .click( FlaggedRevsReview.deadvertiseReviewing );
356365 },
357366
358367 /*
@@ -363,12 +372,23 @@
364373 return; // failed
365374 }
366375 }
367 - // Update notice to say that user is not advertising...
368 - var msgkey = $('#mw-fr-input-refid')
 376+ // Build notice to say that user is not advertising...
 377+ var msgkey = $('#mw-fr-input-refid').length
369378 ? 'revreview-sadv-reviewing-c' // diff
370379 : 'revreview-sadv-reviewing-p' // page
371 - $('#mw-fr-reviewing-status').html( mw.msg( msgkey, [mw.config.get('wgUserName')] ) );
372 - $('#mw-fr-reviewing-start').click( FlaggedRevsReview.advertiseReviewing );
 380+ var $underReview = $(
 381+ '<span class="fr-make-under-review">' +
 382+ mw.message( msgkey )
 383+ .escaped()
 384+ .replace( /\$1/, mw.html.element( 'a',
 385+ { id: 'mw-fr-reviewing-start' }, mw.msg( 'revreview-adv-start-link' ) ) ) +
 386+ '</span>'
 387+ );
 388+ $underReview.find( '#mw-fr-reviewing-start')
 389+ .css( 'cursor', 'pointer' )
 390+ .click( FlaggedRevsReview.advertiseReviewing );
 391+ // Update notice to say that user is not advertising...
 392+ $('#mw-fr-reviewing-status').empty().append( $underReview );
373393 },
374394
375395 /*
@@ -415,8 +435,8 @@
416436 FlaggedRevsReview.enableAjaxReviewActivity();
417437
418438 // Flag users as "no longer reviewing" on navigate-away
419 -window.onbeforeunload = function( e ) {
 439+$( window ).bind( 'beforeunload', function( e ) {
420440 if ( FlaggedRevsReview.isUserReviewing == 1 ) {
421441 FlaggedRevsReview.deadvertiseReviewing();
422442 }
423 -};
 443+} );

Follow-up revisions

RevisionCommit summaryAuthorDate
r98807MFT r97886,r97892,r97899,r97969,r98179,r98654: ajax reviewing status code cha...aaron20:55, 3 October 2011
r100383REL1_18 MFT r97886, r97899, r97969, r98179, r98497, r98654, r98773, r98801, r...reedy21:36, 20 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97886* Made "under review" notices require the user's consent (bug 31093)...aaron03:38, 23 September 2011

Comments

#Comment by Siebrand (talk | contribs)   04:42, 27 September 2011

Please add message documentation for the newly added messages. Thanks.

#Comment by Aaron Schulz (talk | contribs)   18:27, 3 October 2011

qqq should have been updated in my sweep.

Status & tagging log