Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -101,6 +101,7 @@ |
102 | 102 | 'review_denied' => 'Permission denied.', |
103 | 103 | 'review_param_missing' => 'A parameter is missing or invalid.', |
104 | 104 | 'review_cannot_undo' => 'Cannot undo these changes because further pending edits changed the same areas.', |
| 105 | + 'review_reject_excessive' => 'Cannot reject this many edits at once.', |
105 | 106 | |
106 | 107 | 'revreview-current' => 'Pending changes', |
107 | 108 | 'revreview-depth' => 'Depth', |
— | — | @@ -256,12 +257,11 @@ |
257 | 258 | 'revreview-reject-summary' => 'Edit summary:', |
258 | 259 | 'revreview-reject-confirm' => 'Reject these changes', |
259 | 260 | 'revreview-reject-cancel' => 'Cancel', |
260 | | - 'revreview-reject-summary-cur' => 'Rejected the last {{PLURAL:$1|one change|$1 changes}} (by $2) and restored revision $3', |
261 | | - 'revreview-reject-summary-old' => 'Rejected the first {{PLURAL:$1|one change|$1 changes}} (by $2) following revision $3', |
262 | | - 'revreview-reject-summary-cur-short' => 'Rejected the last {{PLURAL:$1|one change|$1 changes}} and restored revision $2', |
263 | | - 'revreview-reject-summary-old-short' => 'Rejected the first {{PLURAL:$1|one change|$1 changes}} following revision $2', |
| 261 | + 'revreview-reject-summary-cur' => 'Rejected the last {{PLURAL:$1|one change|$1 changes}} (by $2) and restored revision $3 by $4', |
| 262 | + 'revreview-reject-summary-old' => 'Rejected the first {{PLURAL:$1|one change|$1 changes}} (by $2) that followed revision $3 by $4', |
| 263 | + 'revreview-reject-summary-cur-short' => 'Rejected the last {{PLURAL:$1|one change|$1 changes}} and restored revision $2 by $3', |
| 264 | + 'revreview-reject-summary-old-short' => 'Rejected the first {{PLURAL:$1|one change|$1 changes}} that followed revision $2 by $3', |
264 | 265 | 'revreview-reject-usercount' => '{{PLURAL:$1|one user|$1 users}}', |
265 | | - 'revreview-reject-toomanyedits' => 'Cannot reject this many edits at once.', |
266 | 266 | |
267 | 267 | 'revreview-reviewlink' => 'pending edits', |
268 | 268 | 'revreview-reviewlink-title' => 'View diff of all pending changes', |
Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php |
— | — | @@ -313,15 +313,15 @@ |
314 | 314 | $newRev = Revision::newFromTitle( $this->page, $this->oldid ); |
315 | 315 | $oldRev = Revision::newFromTitle( $this->page, $this->refid ); |
316 | 316 | # Do not mess with archived/deleted revisions |
317 | | - if ( is_null( $oldRev ) || $oldRev->mDeleted ) { |
| 317 | + if ( !$oldRev || $newRev->isDeleted( Revision::DELETED_TEXT ) ) { |
318 | 318 | return 'review_bad_oldid'; |
319 | | - } elseif ( is_null( $newRev ) || $newRev->mDeleted ) { |
| 319 | + } elseif ( !$newRev || $newRev->isDeleted( Revision::DELETED_TEXT ) ) { |
320 | 320 | return 'review_bad_oldid'; |
321 | 321 | } |
322 | 322 | # Go to confirmation screen first |
323 | 323 | if ( !$this->rejectConfirm ) { |
324 | | - $this->rejectConfirmationForm( $oldRev, $newRev ); |
325 | | - return false; // xxx |
| 324 | + $status = $this->rejectConfirmationForm( $oldRev, $newRev ); |
| 325 | + return is_string( $status ) ? $status : false; // xxx |
326 | 326 | } |
327 | 327 | $article = new Article( $this->page ); |
328 | 328 | $new_text = $article->getUndoText( $newRev, $oldRev ); |
— | — | @@ -747,7 +747,7 @@ |
748 | 748 | $form .= "<br />"; // Don't put too much on one line |
749 | 749 | } |
750 | 750 | $form .= "<span id='mw-fr-commentbox' style='clear:both'>" . |
751 | | - Xml::inputLabel( wfMsg( 'revreview-log' ), 'wpReason', 'wpReason', 35, '', |
| 751 | + Xml::inputLabel( wfMsg( 'revreview-log' ), 'wpReason', 'wpReason', 40, '', |
752 | 752 | array( 'class' => 'fr-comment-box' ) ) . "   </span>"; |
753 | 753 | } |
754 | 754 | # Determine if there will be reject button |
— | — | @@ -997,16 +997,17 @@ |
998 | 998 | * A bit hacky, but we don't have a way to pass more complicated |
999 | 999 | * UI things back up, since RevisionReview expects either true |
1000 | 1000 | * or a string message key |
| 1001 | + * @return mixed (string/true) |
1001 | 1002 | */ |
1002 | 1003 | private function rejectConfirmationForm( Revision $oldRev, Revision $newRev ) { |
1003 | | - global $wgOut, $wgLang; |
| 1004 | + global $wgOut, $wgLang, $wgContLang; |
1004 | 1005 | $thisPage = SpecialPage::getTitleFor( 'RevisionReview' ); |
1005 | 1006 | |
1006 | 1007 | $wgOut->addHtml( '<div class="plainlinks">' ); |
1007 | 1008 | |
1008 | 1009 | $dbr = wfGetDB( DB_SLAVE ); |
1009 | 1010 | $res = $dbr->select( 'revision', |
1010 | | - array( 'rev_id', 'rev_user_text' ), |
| 1011 | + Revision::selectFields(), |
1011 | 1012 | array( |
1012 | 1013 | 'rev_page' => $oldRev->getPage(), |
1013 | 1014 | 'rev_id > ' . $dbr->addQuotes( $oldRev->getId() ), |
— | — | @@ -1016,16 +1017,19 @@ |
1017 | 1018 | array( 'LIMIT' => 251 ) // sanity check |
1018 | 1019 | ); |
1019 | 1020 | if ( !$dbr->numRows( $res ) ) { |
1020 | | - $wgOut->redirect( $this->getPage()->getFullUrl() ); // sanity check |
1021 | | - return; |
| 1021 | + return 'review_bad_oldid'; |
1022 | 1022 | } elseif ( $dbr->numRows( $res ) > 250 ) { |
1023 | | - $wgOut->showErrorPage( 'internalerror', 'revreview-reject-toomanyedits' ); |
1024 | | - return; |
| 1023 | + return 'review_reject_excessive'; |
1025 | 1024 | } |
1026 | 1025 | |
1027 | | - $rejectIds = array(); |
1028 | | - foreach ( $res as $r ) { |
1029 | | - $rejectIds[$r->rev_id] = "[[User:{$r->rev_user_text}|{$r->rev_user_text}]]"; |
| 1026 | + $rejectIds = $rejectAuthors = array(); |
| 1027 | + $UserNS = $wgContLang->getNsText( NS_USER ); |
| 1028 | + foreach ( $res as $row ) { |
| 1029 | + $rev = new Revision( $row ); |
| 1030 | + $rejectIds[] = $rev->getId(); |
| 1031 | + $rejectAuthors[] = $rev->isDeleted( Revision::DELETED_USER ) |
| 1032 | + ? wfMsg( 'rev-deleted-user' ) |
| 1033 | + : "[[{$UserNS}:{$rev->getUserText()}|{$rev->getUserText()}]]"; |
1030 | 1034 | } |
1031 | 1035 | |
1032 | 1036 | // List of revisions being undone... |
— | — | @@ -1034,8 +1038,7 @@ |
1035 | 1039 | // FIXME: we need a generic revision list class |
1036 | 1040 | $spRevDelete = SpecialPage::getPage( 'RevisionReview' ); |
1037 | 1041 | $spRevDelete->skin = $this->user->getSkin(); // XXX |
1038 | | - $list = new RevDel_RevisionList( $spRevDelete, $oldRev->getTitle(), |
1039 | | - array_keys( $rejectIds ) ); |
| 1042 | + $list = new RevDel_RevisionList( $spRevDelete, $oldRev->getTitle(), $rejectIds ); |
1040 | 1043 | for ( $list->reset(); $list->current(); $list->next() ) { |
1041 | 1044 | $item = $list->current(); |
1042 | 1045 | if ( $item->canView() ) { |
— | — | @@ -1052,23 +1055,28 @@ |
1053 | 1056 | } |
1054 | 1057 | |
1055 | 1058 | // Determine the default edit summary... |
| 1059 | + $oldRevAuthor = $oldRev->isDeleted( Revision::DELETED_USER ) |
| 1060 | + ? wfMsg( 'rev-deleted-user' ) |
| 1061 | + : $oldRev->getUserText(); |
1056 | 1062 | // NOTE: *-cur msg wording not safe for (unlikely) edit auto-merge |
1057 | | - $rejectAuthors = array_values( array_unique( $rejectIds ) ); |
| 1063 | + $rejectAuthors = array_values( array_unique( $rejectAuthors ) ); |
1058 | 1064 | if ( count( $rejectAuthors ) > 3 ) { |
1059 | 1065 | $msg = $newRev->isCurrent() |
1060 | 1066 | ? 'revreview-reject-summary-cur-short' |
1061 | 1067 | : 'revreview-reject-summary-old-short'; |
1062 | 1068 | $defaultSummary = wfMsgExt( $msg, 'parsemag', |
1063 | | - $wgLang->formatNum( count( $rejectIds ) ), $oldRev->getId() ); |
| 1069 | + $wgContLang->formatNum( count( $rejectIds ) ), |
| 1070 | + $oldRev->getId(), |
| 1071 | + $oldRevAuthor ); |
1064 | 1072 | } else { |
1065 | 1073 | $msg = $newRev->isCurrent() |
1066 | 1074 | ? 'revreview-reject-summary-cur' |
1067 | 1075 | : 'revreview-reject-summary-old'; |
1068 | 1076 | $defaultSummary = wfMsgExt( $msg, 'parsemag', |
1069 | | - $wgLang->formatNum( count( $rejectIds ) ), |
1070 | | - $wgLang->listToText( $rejectAuthors ), |
1071 | | - $oldRev->getId() |
1072 | | - ); |
| 1077 | + $wgContLang->formatNum( count( $rejectIds ) ), |
| 1078 | + $wgContLang->listToText( $rejectAuthors ), |
| 1079 | + $oldRev->getId(), |
| 1080 | + $oldRevAuthor ); |
1073 | 1081 | } |
1074 | 1082 | // Append any review comment... |
1075 | 1083 | if ( $this->comment != '' ) { |
— | — | @@ -1099,6 +1107,7 @@ |
1100 | 1108 | $form .= Xml::closeElement( 'form' ); |
1101 | 1109 | |
1102 | 1110 | $wgOut->addHtml( $form ); |
| 1111 | + return true; |
1103 | 1112 | } |
1104 | 1113 | |
1105 | 1114 | private function getSpecialLinks() { |
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | } elseif ( $form->getAction() === 'reject' ) { |
109 | 109 | $wgOut->redirect( $this->page->getFullUrl() ); |
110 | 110 | } |
111 | | - } elseif( $status === false ) { |
| 111 | + } elseif ( $status === false ) { |
112 | 112 | // Reject confirmation screen. HACKY :( |
113 | 113 | return; |
114 | 114 | } else { |