Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -116,6 +116,8 @@ |
117 | 117 | 'revreview-check-flag-p-title' => 'Accept all the currently pending changes along with your own edit. Only use this if you have already seen the entire pending changes diff.', |
118 | 118 | 'revreview-check-flag-u' => 'Accept this unreviewed page', |
119 | 119 | 'revreview-check-flag-u-title' => 'Accept this version of the page. Only use this if you have already seen the entire page.', |
| 120 | + 'revreview-check-flag-y' => 'Accept these changes', |
| 121 | + 'revreview-check-flag-y-title' => 'Accept all the changes that you have made in this edit.', |
120 | 122 | 'revreview-submitedit' => 'Submit changes', |
121 | 123 | 'revreview-submitedit-title' => 'Submit your changes for review', |
122 | 124 | 'revreview-edited' => '\'\'\'Your changes will be displayed to readers once an authorized user reviews them. ([[{{MediaWiki:Validationpage}}|help]])\'\'\' |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | | - * Do edits have to be reviewed before being shown by default? |
| 91 | + * Do edits have to be reviewed before being shown by default (going live)? |
92 | 92 | * @param int $flags, FR_MASTER |
93 | 93 | * @return bool |
94 | 94 | */ |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -1610,45 +1610,76 @@ |
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | /** |
1614 | | - * If submitting this edit will leave it pending |
| 1614 | + * If this edit will not go live on submit (accounting for wpReviewEdit) |
1615 | 1615 | * @param EditPage $editPage |
1616 | 1616 | * @return bool |
1617 | 1617 | */ |
1618 | 1618 | protected function editWillRequireReview( EditPage $editPage ) { |
1619 | 1619 | global $wgRequest; |
1620 | 1620 | $title = $this->article->getTitle(); // convenience |
| 1621 | + if ( !$this->editRequiresReview( $editPage ) ) { |
| 1622 | + return false; // edit will go live immediatly |
| 1623 | + } elseif ( $wgRequest->getCheck( 'wpReviewEdit' ) && $title->userCan( 'review' ) ) { |
| 1624 | + return false; // edit checked off to be reviewed on save |
| 1625 | + } |
| 1626 | + return true; // edit needs review |
| 1627 | + } |
| 1628 | + |
| 1629 | + /** |
| 1630 | + * If this edit will not go live on submit unless wpReviewEdit is checked |
| 1631 | + * @param EditPage $editPage |
| 1632 | + * @return bool |
| 1633 | + */ |
| 1634 | + protected function editRequiresReview( EditPage $editPage ) { |
| 1635 | + $title = $this->article->getTitle(); // convenience |
1621 | 1636 | if ( !$this->article->editsRequireReview() ) { |
1622 | 1637 | return false; // edits go live immediatly |
1623 | | - } elseif ( $wgRequest->getCheck( 'wpReviewEdit' ) && $title->userCan( 'review' ) ) { |
1624 | | - return false; // edit will checked off to be reviewed |
| 1638 | + } elseif ( $this->editWillBeAutoreviewed( $editPage ) ) { |
| 1639 | + return false; // edit will be autoreviewed anyway |
1625 | 1640 | } |
| 1641 | + return true; // edit needs review |
| 1642 | + } |
| 1643 | + |
| 1644 | + /** |
| 1645 | + * If this edit will be auto-reviewed on submit |
| 1646 | + * Note: checking wpReviewEdit does not count as auto-reviewed |
| 1647 | + * @param EditPage $editPage |
| 1648 | + * @return bool |
| 1649 | + */ |
| 1650 | + protected function editWillBeAutoreviewed( EditPage $editPage ) { |
| 1651 | + $title = $this->article->getTitle(); // convenience |
| 1652 | + if ( !$this->article->isReviewable() ) { |
| 1653 | + return false; |
| 1654 | + } |
1626 | 1655 | if ( $title->userCan( 'autoreview' ) ) { |
1627 | 1656 | if ( FlaggedRevs::autoReviewNewPages() && !$this->article->exists() ) { |
1628 | | - return false; // edit will be autoreviewed anyway |
| 1657 | + return true; // edit will be autoreviewed |
1629 | 1658 | } |
1630 | | - $frev = FlaggedRevision::newFromTitle( $title, self::getBaseRevId( $editPage ) ); |
1631 | | - if ( $frev ) { |
1632 | | - return false; // edit will be autoreviewed anyway |
| 1659 | + if ( !isset( $editPage->fr_baseFRev ) ) { |
| 1660 | + $baseRevId = self::getBaseRevId( $editPage ); |
| 1661 | + $editPage->fr_baseFRev = FlaggedRevision::newFromTitle( $title, $baseRevId ); |
1633 | 1662 | } |
| 1663 | + if ( $editPage->fr_baseFRev ) { |
| 1664 | + return true; // edit will be autoreviewed |
| 1665 | + } |
1634 | 1666 | } |
1635 | | - return true; // edit needs review |
| 1667 | + return false; // edit won't be autoreviewed |
1636 | 1668 | } |
1637 | 1669 | |
1638 | 1670 | /** |
1639 | | - * Add a "review pending changes" checkbox to the edit form if: |
| 1671 | + * Add a "review pending changes" checkbox to the edit form iff: |
1640 | 1672 | * (a) there are currently any revisions pending (bug 16713) |
1641 | 1673 | * (b) this is an unreviewed page (bug 23970) |
1642 | 1674 | */ |
1643 | 1675 | public function addReviewCheck( EditPage $editPage, array &$checkboxes, &$tabindex ) { |
1644 | | - global $wgUser, $wgRequest; |
1645 | | - if ( !$this->article->isReviewable() |
1646 | | - || !$this->article->getTitle()->userCan( 'review' ) |
1647 | | - || ( $this->article->getStable() && !$this->article->revsArePending() ) |
1648 | | - ) { |
| 1676 | + global $wgRequest; |
| 1677 | + $title = $this->article->getTitle(); // convenience |
| 1678 | + if ( !$this->article->isReviewable() || !$title->userCan( 'review' ) ) { |
1649 | 1679 | return true; // not needed |
| 1680 | + } elseif ( $this->editWillBeAutoreviewed( $editPage ) ) { |
| 1681 | + return true; // edit will be auto-reviewed |
1650 | 1682 | } |
1651 | | - $oldid = $wgRequest->getInt( 'baseRevId', $this->article->getLatest() ); |
1652 | | - if ( $oldid == $this->article->getLatest() ) { |
| 1683 | + if ( self::getBaseRevId( $editPage ) == $this->article->getLatest() ) { |
1653 | 1684 | # For pages with either no stable version, or an outdated one, let |
1654 | 1685 | # the user decide if he/she wants it reviewed on the spot. One might |
1655 | 1686 | # do this if he/she just saw the diff-to-stable and *then* decided to edit. |
— | — | @@ -1659,10 +1690,17 @@ |
1660 | 1691 | array( 'tabindex' => ++$tabindex, 'id' => 'wpReviewEdit' ) |
1661 | 1692 | ); |
1662 | 1693 | $attribs = array( 'for' => 'wpReviewEdit' ); |
1663 | | - // For pending changes... |
| 1694 | + // For reviewed pages... |
1664 | 1695 | if ( $this->article->getStable() ) { |
1665 | | - $attribs['title'] = wfMsg( 'revreview-check-flag-p-title' ); |
1666 | | - $labelMsg = wfMsgExt( 'revreview-check-flag-p', 'parseinline' ); |
| 1696 | + // For pending changes... |
| 1697 | + if ( $this->article->revsArePending() ) { |
| 1698 | + $attribs['title'] = wfMsg( 'revreview-check-flag-p-title' ); |
| 1699 | + $labelMsg = wfMsgExt( 'revreview-check-flag-p', 'parseinline' ); |
| 1700 | + // For just the user's changes... |
| 1701 | + } else { |
| 1702 | + $attribs['title'] = wfMsg( 'revreview-check-flag-y-title' ); |
| 1703 | + $labelMsg = wfMsgExt( 'revreview-check-flag-y', 'parseinline' ); |
| 1704 | + } |
1667 | 1705 | // For unreviewed pages... |
1668 | 1706 | } else { |
1669 | 1707 | $attribs['title'] = wfMsg( 'revreview-check-flag-u-title' ); |
— | — | @@ -1673,7 +1711,7 @@ |
1674 | 1712 | } |
1675 | 1713 | return true; |
1676 | 1714 | } |
1677 | | - |
| 1715 | + |
1678 | 1716 | /** |
1679 | 1717 | * (a) Add a hidden field that has the rev ID the text is based off. |
1680 | 1718 | * (b) If an edit was undone, add a hidden field that has the rev ID of that edit. |
— | — | @@ -1692,7 +1730,7 @@ |
1693 | 1731 | |
1694 | 1732 | /** |
1695 | 1733 | * Guess the rev ID the text of this form is based off |
1696 | | - * Note: baseRevId trusted for Reviewers - text checked for others. |
| 1734 | + * Note: baseRevId trusted for Reviewers - check text for others. |
1697 | 1735 | * @return int |
1698 | 1736 | */ |
1699 | 1737 | protected static function getBaseRevId( EditPage $editPage ) { |