r83288 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83287‎ | r83288 | r83289 >
Date:15:00, 5 March 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 27797) Don't let users set their own revisions to OK
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -260,6 +260,14 @@
261261 if ( !$this->isValidStatus( $status ) ) {
262262 throw new MWException( "Tried to save invalid code revision status" );
263263 }
 264+
 265+ // Don't allow the user account tied to the committer account mark their own revisions as ok
 266+ // Obviously only works if user accounts are tied!
 267+ $wikiUser = $this->getWikiUser();
 268+ if ( $status == 'ok' && $wikiUser && $user->getName() == $wikiUser->getName() ) {
 269+ return false;
 270+ }
 271+
264272 // Get the old status from the master
265273 $dbw = wfGetDB( DB_MASTER );
266274 $this->oldStatus = $dbw->selectField( 'code_rev',
Index: trunk/extensions/CodeReview/backend/CodeRepository.php
@@ -469,8 +469,9 @@
470470 * @return User|bool
471471 */
472472 public function authorWikiUser( $author ) {
473 - if ( isset( self::$userLinks[$author] ) )
 473+ if ( isset( self::$userLinks[$author] ) ) {
474474 return self::$userLinks[$author];
 475+ }
475476
476477 $dbr = wfGetDB( DB_SLAVE );
477478 $wikiUser = $dbr->selectField(

Comments

#Comment by Hashar (talk | contribs)   18:59, 7 March 2011

bug 27797 reopened

#Comment by Hashar (talk | contribs)   21:01, 10 March 2011

ok :)

Status & tagging log