r61104 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61103‎ | r61104 | r61105 >
Date:22:35, 15 January 2010
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Disable 'review' button for already flagged revisions for binary flag case (except for special diff-to-stable include change scenario)
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/review.js (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -379,35 +379,35 @@
380380 return array( $labels, $minLevels );
381381 }
382382
383 -
384 - public static function ratingSubmitButtons( $frev, $disabled ) {
 383+ // $synced param is used to force the review button to be usable
 384+ public static function ratingSubmitButtons( $frev, $disabled, $rereview = false ) {
385385 $disAttrib = array( 'disabled' => 'disabled' );
386386 # Add the submit button
387387 if ( FlaggedRevs::binaryFlagging() ) {
388388 # We may want to re-review to change the notes ($wgFlaggedRevsComments)
389389 $s = Xml::submitButton( wfMsg( 'revreview-submit-review' ),
390390 array(
391 - 'id' => 'mw-fr-submitreview',
 391+ 'name' => 'wpApprove',
 392+ 'id' => 'mw-fr-submitreview',
392393 'accesskey' => wfMsg( 'revreview-ak-review' ),
393 - 'name' => 'wpApprove',
394 - 'title' => wfMsg( 'revreview-tt-flag' ) . ' [' .
 394+ 'title' => wfMsg( 'revreview-tt-flag' ) . ' [' .
395395 wfMsg( 'revreview-ak-review' ) . ']'
396 - ) + ( $disabled ? $disAttrib : array() )
 396+ ) + ( ( $disabled || ($frev && !$rereview) ) ? $disAttrib : array() )
397397 );
398398 $s .= ' ';
399399 $s .= Xml::submitButton( wfMsg( 'revreview-submit-unreview' ),
400400 array(
401 - 'id' => 'mw-fr-submitunreview',
402401 'name' => 'wpUnapprove',
 402+ 'id' => 'mw-fr-submitunreview',
403403 'title' => wfMsg( 'revreview-tt-unflag' )
404404 ) + ( ( $disabled || !$frev ) ? $disAttrib : array() )
405405 );
406406 } else {
407407 $s = Xml::submitButton( wfMsg( 'revreview-submit' ),
408408 array(
409 - 'id' => 'mw-fr-submitreview',
 409+ 'id' => 'mw-fr-submitreview',
410410 'accesskey' => wfMsg( 'revreview-ak-review' ),
411 - 'title' => wfMsg( 'revreview-tt-review' ) . ' [' .
 411+ 'title' => wfMsg( 'revreview-tt-review' ) . ' [' .
412412 wfMsg( 'revreview-ak-review' ) . ']'
413413 ) + ( $disabled ? $disAttrib : array() )
414414 );
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -61,7 +61,6 @@
6262 'flagMsg' => wfMsgHtml( 'revreview-submit-review' ),
6363 'unflagMsg' => wfMsgHtml( 'revreview-submit-unreview' ),
6464 'flagLegMsg' => wfMsgHtml( 'revreview-flag' ),
65 - 'reflagLegMsg' => wfMsgHtml( 'revreview-reflag' ),
6665 'sendingMsg' => wfMsgHtml( 'revreview-submitting' ),
6766 'actioncomplete' => wfMsgHtml( 'actioncomplete' ),
6867 'actionfailed' => wfMsgHtml( 'actionfailed' ),
Index: trunk/extensions/FlaggedRevs/client/review.js
@@ -61,10 +61,12 @@
6262 if( notebox ) {
6363 notebox.style.display = quality ? 'inline' : 'none';
6464 }
65 - // If only a few levels are zero, don't show submit link
66 - var submit = document.getElementById('mw-fr-submitreview');
67 - if( submit ) {
68 - submit.disabled = ( somezero && !allzero ) ? 'disabled' : '';
 65+ // If only a few levels are zero and there is only one
 66+ // submit button (for review/unreview), then disable it.
 67+ var rsubmit = document.getElementById('mw-fr-submitreview');
 68+ var usubmit = document.getElementById('mw-fr-submitunreview');
 69+ if( rsubmit && !usubmit ) {
 70+ rsubmit.disabled = ( somezero && !allzero ) ? 'disabled' : '';
6971 }
7072 // Clear note box data if not shown
7173 var notes = document.getElementById('wpNotes');
@@ -220,12 +222,12 @@
221223 if( usubmit ) {
222224 // Revision was flagged
223225 if( rsubmit.value == wgAjaxReview.sendingMsg ) {
224 - legend.innerHTML = '<strong>'+wgAjaxReview.reflagLegMsg+'</strong>';
 226+ // For template review case go from re-review to review message
 227+ legend.innerHTML = '<strong>'+wgAjaxReview.flagLegMsg+'</strong>';
225228 rsubmit.value = wgAjaxReview.flagMsg; // back to normal
226229 usubmit.disabled = ''; // unlock unflag button
227230 // Revision was unflagged
228231 } else if( usubmit.value == wgAjaxReview.sendingMsg ) {
229 - legend.innerHTML = '<strong>'+wgAjaxReview.flagLegMsg+'</strong>';
230232 usubmit.value = wgAjaxReview.unflagMsg; // back to normal
231233 }
232234 } else {
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -1438,11 +1438,11 @@
14391439 # Get the revision being displayed
14401440 $id = $wgOut->getRevisionId();
14411441 if ( !$id ) {
1442 - if ( !$this->isDiffFromStable ) {
 1442+ if ( $this->isDiffFromStable ) {
 1443+ $rev = Revision::newFromTitle( $this->article->getTitle() );
 1444+ $id = $rev->getId(); // if diff-to-stable, we know the revision is the current
 1445+ } else {
14431446 return false; // only safe to assume current if diff-to-stable
1444 - } else {
1445 - $rev = Revision::newFromTitle( $this->article->getTitle() );
1446 - $id = $rev->getId();
14471447 }
14481448 } else {
14491449 $rev = Revision::newFromTitle( $this->article->getTitle(), $id );
@@ -1476,10 +1476,14 @@
14771477 $flags = $oldFlags;
14781478 }
14791479 $reviewNotes = $srev->getComment();
 1480+ # Re-review button is need for template/file only review case
 1481+ $allowRereview = ($srev->getRevId() == $id)
 1482+ && !FlaggedRevs::stableVersionIsSynced( $srev, $this->article );
14801483 } else {
14811484 $flags = $oldFlags;
14821485 // Get existing notes to pre-fill field
14831486 $reviewNotes = $frev ? $frev->getComment() : "";
 1487+ $allowRereview = false; // re-review button
14841488 }
14851489
14861490 # Begin form...
@@ -1493,7 +1497,7 @@
14941498 $form .= Xml::openElement( 'fieldset',
14951499 array( 'class' => 'flaggedrevs_reviewform noprint' ) );
14961500 # Add appropriate legend text
1497 - $legendMsg = ( FlaggedRevs::binaryFlagging() && $frev )
 1501+ $legendMsg = ( FlaggedRevs::binaryFlagging() && $allowRereview )
14981502 ? 'revreview-reflag'
14991503 : 'revreview-flag';
15001504 $form .= Xml::openElement( 'legend', array( 'id' => 'mw-fr-reviewformlegend' ) );
@@ -1569,7 +1573,7 @@
15701574 array( 'class' => 'fr-comment-box' ) ) . "&nbsp;&nbsp;&nbsp;</span>";
15711575 }
15721576 # Add the submit buttons
1573 - $form .= FlaggedRevsXML::ratingSubmitButtons( $frev, (bool)$toggle );
 1577+ $form .= FlaggedRevsXML::ratingSubmitButtons( $frev, (bool)$toggle, $allowRereview );
15741578
15751579 $form .= Xml::closeElement( 'span' );
15761580 $form .= Xml::closeElement( 'div' ) . "\n";

Follow-up revisions

RevisionCommit summaryAuthorDate
r61105JS follow-up for r61104aaron22:38, 15 January 2010

Comments

#Comment by Platonides (talk | contribs)   00:03, 17 January 2010

I assume that the comment is outdated and the $synced param mentioned in the comment is the one named $rereview in the prototype.

#Comment by Tim Starling (talk | contribs)   02:07, 22 January 2010

Marking fixme due to the unanswered comment, please mark OK after a response is given.

#Comment by Tim Starling (talk | contribs)   02:09, 22 January 2010

Never mind, was fixed in r61157.

Status & tagging log