Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -1563,17 +1563,8 @@ |
1564 | 1564 | * @TODO: would be nice if hook passed in button attribs, not XML |
1565 | 1565 | */ |
1566 | 1566 | 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 |
1578 | 1569 | } |
1579 | 1570 | if ( extension_loaded( 'domxml' ) ) { |
1580 | 1571 | wfDebug( "Warning: you have the obsolete domxml extension for PHP. Please remove it!\n" ); |
— | — | @@ -1593,6 +1584,31 @@ |
1594 | 1585 | } |
1595 | 1586 | |
1596 | 1587 | /** |
| 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 | + /** |
1597 | 1613 | * Add a "review pending changes" checkbox to the edit form if: |
1598 | 1614 | * (a) there are currently any revisions pending (bug 16713) |
1599 | 1615 | * (b) this is an unreviewed page (bug 23970) |