r69274 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69273‎ | r69274 | r69275 >
Date:21:53, 11 July 2010
Author:aaron
Status:deferred
Tags:
Comment:
* Added review_not_flagged error code
* Removed unused sync error msgs
* Other error msg cleanups
* Validation key not needed for de-approval
Modified paths:
  • /trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -86,17 +86,13 @@
8787 'revreview-basic-same' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>.',
8888 'revreview-basic-source' => 'A [{{fullurl:{{FULLPAGENAMEE}}|stableid=$1}} checked version] of this page, [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>, was based off this revision.',
8989 'revreview-failed' => "'''Unable to review this revision.''' The submission was incomplete or otherwise invalid.",
90 - 'revreview-changed' => '\'\'\'The requested action could not be performed on this revision of [[:$1|$1]].\'\'\'
9190
92 -A template or file may have been requested when no specific version was specified.
93 -This can happen if a dynamic template transcludes another file or template depending on a variable that changed since you started reviewing this page.
94 -Refreshing the page and rereviewing can solve this problem.',
95 -
9691 'review_page_invalid' => 'The target page title is invalid.',
9792 'review_page_notexists' => 'The target page does not exist.',
9893 'review_page_unreviewable' => 'The target page is not reviewable.',
9994 'review_no_oldid' => 'No revision ID specified.',
100 - 'review_bad_oldid' => 'There is no such target revision.',
 95+ 'review_bad_oldid' => 'The target revision does not exist.',
 96+ 'review_not_flagged' => 'The target revision is not currently marked as reviewed.',
10197 'review_too_low' => 'Revision cannot be reviewed with some fields left "inadequate".',
10298 'review_bad_key' => 'Invalid inclusion parameter key.',
10399 'review_denied' => 'Permission denied.',
Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php
@@ -219,11 +219,13 @@
220220 {
221221 return 'review_too_low';
222222 }
223 - # Special token to discourage fiddling...
224 - $k = self::validationKey(
225 - $this->templateParams, $this->imageParams, $this->fileVersion, $this->oldid );
226 - if ( $this->validatedParams !== $k ) {
227 - return 'review_bad_key';
 223+ # Special token to discourage fiddling with template/files...
 224+ if ( $this->isApproval() ) {
 225+ $k = self::validationKey(
 226+ $this->templateParams, $this->imageParams, $this->fileVersion, $this->oldid );
 227+ if ( $this->validatedParams !== $k ) {
 228+ return 'review_bad_key';
 229+ }
228230 }
229231 # Check permissions and validate
230232 # FIXME: invalid vs denied
@@ -301,7 +303,7 @@
302304 $frev = FlaggedRevision::newFromTitle( $this->page, $this->oldid );
303305 # If we can't find this flagged rev, return to page???
304306 if ( is_null( $frev ) ) {
305 - return 'review_bad_oldid';
 307+ return 'review_not_flagged';
306308 }
307309 $status = $this->unapproveRevision( $frev );
308310 }
@@ -938,19 +940,6 @@
939941 return $form;
940942 }
941943
942 - public function syncFailureHTML( array $status, $showlinks = false ) {
943 - $form = wfMsgExt( 'revreview-changed', 'parse', $this->page->getPrefixedText() );
944 - $form .= "<ul>";
945 - foreach ( $status as $n => $text ) {
946 - $form .= "<li><i>$text</i></li>\n";
947 - }
948 - $form .= "</ul>";
949 - if ( $showlinks ) {
950 - $form .= wfMsg( 'returnto', $this->skin->makeLinkObj( $this->page ) );
951 - }
952 - return $form;
953 - }
954 -
955944 private function getSpecialLinks() {
956945 $s = '<p>' . wfMsg( 'returnto',
957946 $this->skin->makeLinkObj( SpecialPage::getTitleFor( 'UnreviewedPages' ) ) ) . '</p>';
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php
@@ -101,14 +101,7 @@
102102 } else {
103103 $wgOut->addHTML( $form->deapprovalSuccessHTML( true ) );
104104 }
105 - // Failure for unflagging
106 - } elseif ( !$form->isApproval() ) {
107 - $wgOut->redirect( $this->page->getFullUrl() ); // already unflagged
108 - // Sync failure for flagging
109 - } elseif ( is_array( $status ) ) {
110 - $wgOut->setPageTitle( wfMsgHtml( 'internalerror' ) );
111 - $wgOut->addHTML( $form->syncFailureHTML( $status, true ) );
112 - // Any other fails for flagging...
 105+ // Failure for flagging or unflagging
113106 } else {
114107 if ( $status === 'review_denied' ) {
115108 $wgOut->permissionRequired( 'badaccess-group0' ); // protected?
@@ -116,6 +109,8 @@
117110 $wgOut->permissionRequired( 'badaccess-group0' ); // fiddling
118111 } elseif ( $status === 'review_bad_oldid' ) {
119112 $wgOut->showErrorPage( 'internalerror', 'revreview-revnotfound' );
 113+ } elseif ( $status === 'review_not_flagged' ) {
 114+ $wgOut->redirect( $this->page->getFullUrl() ); // already unflagged
120115 } elseif ( $status === 'review_too_low' ) {
121116 $wgOut->addWikiText( wfMsg( 'revreview-toolow' ) );
122117 } else {
@@ -223,23 +218,18 @@
224219 }
225220 # Try submission...
226221 $status = $form->submit();
227 - # Approve/de-approve success
 222+ # Success...
228223 if ( $status === true ) {
229224 $tier = FlaggedRevs::getLevelTier( $form->getDims() ) + 1; // shift to 0-3
230 - if ( $form->isApproval() ) {
 225+ if ( $form->isApproval() ) { // approve
231226 return "<suc#><t#$tier>" . $form->approvalSuccessHTML( false );
232 - } else {
 227+ } else { // de-approve
233228 return "<suc#><t#$tier>" . $form->deapprovalSuccessHTML( false );
234229 }
235 - # De-approve failure
236 - } elseif ( !$form->isApproval() ) {
237 - return "<suc#><t#0>"; // failure -> already unflagged
238 - # Approve sync failure
239 - } elseif ( is_array( $status ) ) {
240 - return '<err#>' . $form->syncFailureHTML( $status, false );
241 - # Other approval failures
242 - } else { // hmmm?
243 - return '<err#>' . wfMsgExt( 'revreview-failed', 'parseinline' );
 230+ # Failure...
 231+ } else {
 232+ return '<err#>' . wfMsgExt( 'revreview-failed', 'parse' ) .
 233+ '<p>' . wfMsgHtml( $status ) . '</p>';
244234 }
245235 }
246236 }

Status & tagging log