r44823 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44822‎ | r44823 | r44824 >
Date:02:00, 20 December 2008
Author:aaron
Status:deferred (Comments)
Tags:
Comment:
(bug 16713) Make flagging easier if editing current unflagged version
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -423,6 +423,7 @@
424424 $wgHooks['DiffViewHeader'][] = 'FlaggedRevsHooks::onDiffViewHeader';
425425 # Autoreview stuff
426426 $wgHooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsHooks::addRevisionIDField';
 427+$wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsHooks::addReviewCheck';
427428
428429 # Add CSS/JS as needed
429430 $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS';
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -1008,11 +1008,18 @@
10091009 public static function autoReviewEdit( $article, $user, $text, $rev, $flags, $patrol = true ) {
10101010 global $wgMemc, $wgRevisionCacheExpiry;
10111011 wfProfileIn( __METHOD__ );
1012 -
 1012+ # Default tags to level 1 for each dimension
 1013+ if( !is_array($flags) ) {
 1014+ $flags = array();
 1015+ foreach( self::getDimensions() as $tag => $minQL ) {
 1016+ $flags[$tag] = 1;
 1017+ }
 1018+ }
10131019 $quality = 0;
10141020 if( self::isQuality($flags) ) {
10151021 $quality = self::isPristine($flags) ? 2 : 1;
10161022 }
 1023+
10171024 $tmpset = $imgset = array();
10181025 $poutput = false;
10191026
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -659,6 +659,12 @@
660660 global $wgFlaggedRevsAutoReview, $wgFlaggedRevsAutoReviewNew, $wgRequest;
661661 # Get the user
662662 $user = is_null($user) ? User::newFromId( $rev->getUser() ) : $user;
 663+ $checked = $wgRequest->getCheck('wpReviewEdit') && $user->isAllowed('review');
 664+ if( $checked ) {
 665+ # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit...
 666+ FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, null, false );
 667+ return true;
 668+ }
663669 if( !$wgFlaggedRevsAutoReview || !$user->isAllowed('autoreview') )
664670 return true;
665671 # If $baseRevId passed in, this is a null edit
@@ -712,10 +718,7 @@
713719 if( $isNullEdit ) {
714720 $flags = $frev->getTags();
715721 } else {
716 - $flags = array();
717 - foreach( FlaggedRevs::getDimensions() as $tag => $minQL ) {
718 - $flags[$tag] = 1;
719 - }
 722+ $flags = null;
720723 }
721724 # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit...
722725 FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags, false );
@@ -1260,6 +1263,29 @@
12611264 return FlaggedArticle::getInstance( $editPage->mArticle )->addRevisionIDField( $editPage, $out );
12621265 }
12631266
 1267+ public static function addReviewCheck( $editPage, &$checkboxes, &$tabindex ) {
 1268+ global $wgUser, $wgRequest;
 1269+ if( !$wgUser->isAllowed('review') ) {
 1270+ return true;
 1271+ }
 1272+ $checkboxes['reviewed'] = '';
 1273+ $reviewLabel = wfMsgExt('revreview-flag', array('parseinline'));
 1274+ $fa = FlaggedArticle::getTitleInstance( $editPage->getArticle() );
 1275+ if( $fa->isReviewable() ) {
 1276+ $srev = $fa->getStableRev();
 1277+ # For pages with either no stable version, or an outdated one, let
 1278+ # the user decide if he/she wants it reviewed on the spot. One might
 1279+ # do this if he/she just saw the diff-to-stable and *then* decided to edit.
 1280+ if( !$srev || $srev->getRevId() != $editPage->getArticle()->getLatest() ) {
 1281+ $attribs = array( 'tabindex' => ++$tabindex, 'id' => 'wpReviewEdit' );
 1282+ $checkboxes['reviewed'] = Xml::check( 'wpReviewEdit',
 1283+ $wgRequest->getCheck('wpReviewEdit'), $attribs ) .
 1284+ ' ' . Xml::label( $reviewLabel, 'wpReviewEdit' );
 1285+ }
 1286+ }
 1287+ return true;
 1288+ }
 1289+
12641290 public static function addBacklogNotice( &$notice ) {
12651291 global $wgUser, $wgTitle, $wgFlaggedRevsBacklog;
12661292 if( !empty($wgTitle) ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44820Add EditPageBeforeEditChecks hook for bug 16713aaron01:15, 20 December 2008

Comments

#Comment by Aaron Schulz (talk | contribs)   02:04, 20 December 2008

Some cleanup in r44825

Status & tagging log