r28722 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28721‎ | r28722 | r28723 >
Date:18:52, 20 December 2007
Author:aaron
Status:old
Tags:
Comment:
Fix some submit breakage
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -565,9 +565,10 @@
566566 $tags = $dbr->selectField('flaggedrevs', 'fr_tags',
567567 array('fr_rev_id' => $rev_id ),
568568 __METHOD__ );
569 - $tags = strval($tags);
 569+ if( !$tags )
 570+ return false;
570571
571 - return self::expandRevisionTags( $tags );
 572+ return self::expandRevisionTags( strval($tags) );
572573 }
573574
574575 /**
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -99,8 +99,10 @@
100100 // We must at least rate each category as 1, the minimum
101101 // Exception: we can rate ALL as unapproved to depreciate a revision
102102 $valid = true;
103 - if( $this->unapprovedTags && ($this->unapprovedTags < count($wgFlaggedRevTags) || !$this->oflags) )
104 - $valid = false;
 103+ if( $this->unapprovedTags > 0 ) {
 104+ if( $this->unapprovedTags < count($wgFlaggedRevTags) || !$this->oflags )
 105+ $valid = false;
 106+ }
105107 if( !$wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) )
106108 $valid = false;
107109
@@ -270,6 +272,7 @@
271273 $wgOut->showErrorPage( 'internalerror', 'revnotfoundtext' );
272274 return;
273275 }
 276+ // We can only unapprove approved revisions...
274277 } else {
275278 $frev = FlaggedRevs::getFlaggedRev( $this->page, $this->oldid );
276279 // If we can't find this flagged rev, return to page???
@@ -439,11 +442,8 @@
440443 * @param Revision $rev
441444 * Removes flagged revision data for this page/id set
442445 */
443 - function unapproveRevision( $row=NULL ) {
 446+ function unapproveRevision( $row ) {
444447 global $wgUser, $wgParser, $wgFlaggedRevsWatch;
445 -
446 - if( is_null($row) )
447 - return false;
448448
449449 $user = $wgUser->getId();
450450
@@ -451,8 +451,7 @@
452452 $dbw = wfGetDB( DB_MASTER );
453453 // Delete from flaggedrevs table
454454 $dbw->delete( 'flaggedrevs',
455 - array( 'fr_page_id' => $row->fr_page_id,
456 - 'fr_rev_id' => $row->fr_rev_id ) );
 455+ array( 'fr_page_id' => $this->page->getArticleID(), 'fr_rev_id' => $row->fr_rev_id ) );
457456 // Wipe versioning params
458457 $dbw->delete( 'flaggedtemplates', array( 'ft_rev_id' => $row->fr_rev_id ) );
459458 $dbw->delete( 'flaggedimages', array( 'fi_rev_id' => $row->fr_rev_id ) );

Status & tagging log