| Index: trunk/phase3/includes/Article.php |
| — | — | @@ -1340,7 +1340,7 @@ |
| 1341 | 1341 | $revisionId ); |
| 1342 | 1342 | |
| 1343 | 1343 | # Mark as patrolled if the user can do so |
| 1344 | | - if( $wgUser->isAllowed( 'patrol' ) ) { |
| | 1344 | + if( $wgUser->isAllowed( 'autopatrol' ) ) { |
| 1345 | 1345 | RecentChange::markPatrolled( $rcid ); |
| 1346 | 1346 | } |
| 1347 | 1347 | } |
| — | — | @@ -1401,7 +1401,7 @@ |
| 1402 | 1402 | $rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, $bot, |
| 1403 | 1403 | '', strlen( $text ), $revisionId ); |
| 1404 | 1404 | # Mark as patrolled if the user can |
| 1405 | | - if( $wgUser->isAllowed( 'patrol' ) ) { |
| | 1405 | + if( $wgUser->isAllowed( 'autopatrol' ) ) { |
| 1406 | 1406 | RecentChange::markPatrolled( $rcid ); |
| 1407 | 1407 | } |
| 1408 | 1408 | } |
| — | — | @@ -1461,7 +1461,7 @@ |
| 1462 | 1462 | */ |
| 1463 | 1463 | function markpatrolled() { |
| 1464 | 1464 | global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser; |
| 1465 | | - $wgOut->setRobotpolicy( 'noindex,nofollow' ); |
| | 1465 | + $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 1466 | 1466 | |
| 1467 | 1467 | # Check RC patrol config. option |
| 1468 | 1468 | if( !$wgUseRCPatrol ) { |
| — | — | @@ -1475,20 +1475,45 @@ |
| 1476 | 1476 | return; |
| 1477 | 1477 | } |
| 1478 | 1478 | |
| | 1479 | + # If we haven't been given an rc_id value, we can't do anything |
| 1479 | 1480 | $rcid = $wgRequest->getVal( 'rcid' ); |
| 1480 | | - if ( !is_null ( $rcid ) ) { |
| 1481 | | - if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) { |
| 1482 | | - RecentChange::markPatrolled( $rcid ); |
| 1483 | | - wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) ); |
| 1484 | | - $wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) ); |
| 1485 | | - $wgOut->addWikiText( wfMsg( 'markedaspatrolledtext' ) ); |
| | 1481 | + if( !$rcid ) { |
| | 1482 | + $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
| | 1483 | + return; |
| | 1484 | + } |
| | 1485 | + |
| | 1486 | + # Handle the 'MarkPatrolled' hook |
| | 1487 | + if( !wfRunHooks( 'MarkPatrolled', array( $rcid, &$wgUser, false ) ) ) { |
| | 1488 | + return; |
| | 1489 | + } |
| | 1490 | + |
| | 1491 | + $return = SpecialPage::getTitleFor( 'Recentchanges' ); |
| | 1492 | + # If it's left up to us, check that the user is allowed to patrol this edit |
| | 1493 | + # If the user has the "autopatrol" right, then we'll assume there are no |
| | 1494 | + # other conditions stopping them doing so |
| | 1495 | + if( !$wgUser->isAllowed( 'autopatrol' ) ) { |
| | 1496 | + $rc = RecentChange::newFromId( $rcid ); |
| | 1497 | + # Graceful error handling, as we've done before here... |
| | 1498 | + # (If the recent change doesn't exist, then it doesn't matter whether |
| | 1499 | + # the user is allowed to patrol it or not; nothing is going to happen |
| | 1500 | + if( is_object( $rc ) && $wgUser->getName() == $rc->getAttribute( 'rc_user_text' ) ) { |
| | 1501 | + # The user made this edit, and can't patrol it |
| | 1502 | + # Tell them so, and then back off |
| | 1503 | + $wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); |
| | 1504 | + $wgOut->addWikiText( wfMsgNoTrans( 'markedaspatrollederror-noautopatrol' ) ); |
| | 1505 | + $wgOut->returnToMain( false, $return ); |
| | 1506 | + return; |
| 1486 | 1507 | } |
| 1487 | | - $rcTitle = SpecialPage::getTitleFor( 'Recentchanges' ); |
| 1488 | | - $wgOut->returnToMain( false, $rcTitle->getPrefixedText() ); |
| 1489 | 1508 | } |
| 1490 | | - else { |
| 1491 | | - $wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
| 1492 | | - } |
| | 1509 | + |
| | 1510 | + # Mark the edit as patrolled |
| | 1511 | + RecentChange::markPatrolled( $rcid ); |
| | 1512 | + wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) ); |
| | 1513 | + |
| | 1514 | + # Inform the user |
| | 1515 | + $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) ); |
| | 1516 | + $wgOut->addWikiText( wfMsgNoTrans( 'markedaspatrolledtext' ) ); |
| | 1517 | + $wgOut->returnToMain( false, $return ); |
| 1493 | 1518 | } |
| 1494 | 1519 | |
| 1495 | 1520 | /** |
| Index: trunk/phase3/includes/RecentChange.php |
| — | — | @@ -64,6 +64,24 @@ |
| 65 | 65 | $rc->numberofWatchingusers = false; |
| 66 | 66 | return $rc; |
| 67 | 67 | } |
| | 68 | + |
| | 69 | + /** |
| | 70 | + * Obtain the recent change with a given rc_id value |
| | 71 | + * |
| | 72 | + * @param $rcid rc_id value to retrieve |
| | 73 | + * @return RecentChange |
| | 74 | + */ |
| | 75 | + public static function newFromId( $rcid ) { |
| | 76 | + $dbr =& wfGetDB( DB_SLAVE ); |
| | 77 | + $res = $dbr->select( 'recentchanges', '*', array( 'rc_id' => $rcid ), __METHOD__ ); |
| | 78 | + if( $res && $dbr->numRows( $res ) > 0 ) { |
| | 79 | + $row = $dbr->fetchObject( $res ); |
| | 80 | + $dbr->freeResult( $res ); |
| | 81 | + return self::newFromRow( $row ); |
| | 82 | + } else { |
| | 83 | + return NULL; |
| | 84 | + } |
| | 85 | + } |
| 68 | 86 | |
| 69 | 87 | # Accessors |
| 70 | 88 | |
| — | — | @@ -449,6 +467,15 @@ |
| 450 | 468 | $this->mExtra = array(); |
| 451 | 469 | } |
| 452 | 470 | |
| | 471 | + /** |
| | 472 | + * Get an attribute value |
| | 473 | + * |
| | 474 | + * @param $name Attribute name |
| | 475 | + * @return mixed |
| | 476 | + */ |
| | 477 | + public function getAttribute( $name ) { |
| | 478 | + return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL; |
| | 479 | + } |
| 453 | 480 | |
| 454 | 481 | /** |
| 455 | 482 | * Gets the end part of the diff URL associated with this object |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -935,6 +935,7 @@ |
| 936 | 936 | $wgGroupPermissions['sysop']['importupload'] = true; |
| 937 | 937 | $wgGroupPermissions['sysop']['move'] = true; |
| 938 | 938 | $wgGroupPermissions['sysop']['patrol'] = true; |
| | 939 | +$wgGroupPermissions['sysop']['autopatrol'] = true; |
| 939 | 940 | $wgGroupPermissions['sysop']['protect'] = true; |
| 940 | 941 | $wgGroupPermissions['sysop']['proxyunbannable'] = true; |
| 941 | 942 | $wgGroupPermissions['sysop']['rollback'] = true; |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -345,8 +345,6 @@ |
| 346 | 346 | * Don't show "you can view and copy the source of this page" message for |
| 347 | 347 | pages which don't exist |
| 348 | 348 | * (bug 8310) Blank line added to top of 'post' when page is blank |
| 349 | | -* (bug 5411) Remove autopatrol preference; users who can mark edits patrolled |
| 350 | | - will now have their edits marked as such regardless |
| 351 | 349 | * (bug 8109) Template parameters ignored in "recentchangestext" |
| 352 | 350 | * Gracefully skip redirect-to-fragment on WebKit versions less than 420; |
| 353 | 351 | it messes up on current versions of Safari but is ok in the latest |
| — | — | @@ -373,6 +371,11 @@ |
| 374 | 372 | * (bug 7685) Use explicit values for ar_text and ar_flags when deleting, |
| 375 | 373 | for better compatibility with MySQL's strict mode |
| 376 | 374 | * Update default interwiki values to reflect changed location of ursine: |
| | 375 | +* (bug 5411) Remove autopatrol preference |
| | 376 | +* Users who have the "autopatrol" permission will have their edits marked as |
| | 377 | + patrolled automatically |
| | 378 | +* Users who do not have the "autopatrol" permission will no longer be able |
| | 379 | + to mark their own edits as patrolled |
| 377 | 380 | |
| 378 | 381 | == Languages updated == |
| 379 | 382 | |
| Index: trunk/phase3/languages/messages/MessagesEn.php |
| — | — | @@ -2117,6 +2117,7 @@ |
| 2118 | 2118 | 'rcpatroldisabledtext' => "The Recent Changes Patrol feature is currently disabled.", |
| 2119 | 2119 | 'markedaspatrollederror' => "Cannot mark as patrolled", |
| 2120 | 2120 | 'markedaspatrollederrortext' => "You need to specify a revision to mark as patrolled.", |
| | 2121 | +'markedaspatrollederror-noautopatrol' => 'You are not allowed to mark your own changes as patrolled.', |
| 2121 | 2122 | |
| 2122 | 2123 | # Monobook.js: tooltips and access keys for monobook |
| 2123 | 2124 | 'Monobook.js' => '/* tooltips and access keys */ |