r68242 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68241‎ | r68242 | r68243 >
Date:21:03, 18 June 2010
Author:aaron
Status:ok
Tags:
Comment:
* (bug 24029) Check wpReviewEdit input value to make sure the submit button has the proper consistent text
* Refactored some code into new editWillRequireReview() function
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -1563,17 +1563,8 @@
15641564 * @TODO: would be nice if hook passed in button attribs, not XML
15651565 */
15661566 public function changeSaveButton( EditPage $editPage, array &$buttons ) {
1567 - $title = $this->article->getTitle(); // convenience
1568 - if ( !$this->article->editsRequireReview() ) {
1569 - return true; // edit will go live immediatly
1570 - } elseif ( $title->userCan( 'autoreview' ) ) {
1571 - if ( FlaggedRevs::autoReviewNewPages() && !$this->article->exists() ) {
1572 - return true; // edit will be autoreviewed anyway
1573 - }
1574 - $frev = FlaggedRevision::newFromTitle( $title, self::getBaseRevId( $editPage ) );
1575 - if ( $frev ) {
1576 - return true; // edit will be autoreviewed anyway
1577 - }
 1567+ if ( !$this->editWillRequireReview( $editPage ) ) {
 1568+ return true; // edit will go live or be reviewed on save
15781569 }
15791570 if ( extension_loaded( 'domxml' ) ) {
15801571 wfDebug( "Warning: you have the obsolete domxml extension for PHP. Please remove it!\n" );
@@ -1593,6 +1584,31 @@
15941585 }
15951586
15961587 /**
 1588+ * If submitting this edit will leave it pending
 1589+ * @param EditPage $editPage
 1590+ * @return bool
 1591+ */
 1592+ protected function editWillRequireReview( EditPage $editPage ) {
 1593+ global $wgRequest;
 1594+ $title = $this->article->getTitle(); // convenience
 1595+ if ( !$this->article->editsRequireReview() ) {
 1596+ return false; // edits go live immediatly
 1597+ } elseif ( $wgRequest->getCheck( 'wpReviewEdit' ) && $title->userCan( 'review' ) ) {
 1598+ return false; // edit will checked off to be reviewed
 1599+ }
 1600+ if ( $title->userCan( 'autoreview' ) ) {
 1601+ if ( FlaggedRevs::autoReviewNewPages() && !$this->article->exists() ) {
 1602+ return false; // edit will be autoreviewed anyway
 1603+ }
 1604+ $frev = FlaggedRevision::newFromTitle( $title, self::getBaseRevId( $editPage ) );
 1605+ if ( $frev ) {
 1606+ return false; // edit will be autoreviewed anyway
 1607+ }
 1608+ }
 1609+ return true; // edit needs review
 1610+ }
 1611+
 1612+ /**
15971613 * Add a "review pending changes" checkbox to the edit form if:
15981614 * (a) there are currently any revisions pending (bug 16713)
15991615 * (b) this is an unreviewed page (bug 23970)

Status & tagging log