* Don't show "you can view and copy the source of this page" message for
pages which don't exist
* (bug 8310) Blank line added to top of 'post' when page is blank
-* (bug 5411) Remove autopatrol preference; users who can mark edits patrolled
- will now have their edits marked as such regardless
* (bug 8109) Template parameters ignored in "recentchangestext"
* Gracefully skip redirect-to-fragment on WebKit versions less than 420;
it messes up on current versions of Safari but is ok in the latest
* (bug 7685) Use explicit values for ar_text and ar_flags when deleting,
for better compatibility with MySQL's strict mode
* Update default interwiki values to reflect changed location of ursine:
+* (bug 5411) Remove autopatrol preference
+* Users who have the "autopatrol" permission will have their edits marked as
+ patrolled automatically
+* Users who do not have the "autopatrol" permission will no longer be able
+ to mark their own edits as patrolled
== Languages updated ==
$revisionId );
# Mark as patrolled if the user can do so
- if( $wgUser->isAllowed( 'patrol' ) ) {
+ if( $wgUser->isAllowed( 'autopatrol' ) ) {
RecentChange::markPatrolled( $rcid );
}
}
$rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, $bot,
'', strlen( $text ), $revisionId );
# Mark as patrolled if the user can
- if( $wgUser->isAllowed( 'patrol' ) ) {
+ if( $wgUser->isAllowed( 'autopatrol' ) ) {
RecentChange::markPatrolled( $rcid );
}
}
*/
function markpatrolled() {
global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser;
- $wgOut->setRobotpolicy( 'noindex,nofollow' );
+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
# Check RC patrol config. option
if( !$wgUseRCPatrol ) {
return;
}
+ # If we haven't been given an rc_id value, we can't do anything
$rcid = $wgRequest->getVal( 'rcid' );
- if ( !is_null ( $rcid ) ) {
- if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) {
- RecentChange::markPatrolled( $rcid );
- wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
- $wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) );
- $wgOut->addWikiText( wfMsg( 'markedaspatrolledtext' ) );
- }
- $rcTitle = SpecialPage::getTitleFor( 'Recentchanges' );
- $wgOut->returnToMain( false, $rcTitle->getPrefixedText() );
+ if( !$rcid ) {
+ $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
+ return;
}
- else {
- $wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
+
+ # Handle the 'MarkPatrolled' hook
+ if( !wfRunHooks( 'MarkPatrolled', array( $rcid, &$wgUser, false ) ) ) {
+ return;
}
+
+ $return = SpecialPage::getTitleFor( 'Recentchanges' );
+ # If it's left up to us, check that the user is allowed to patrol this edit
+ # If the user has the "autopatrol" right, then we'll assume there are no
+ # other conditions stopping them doing so
+ if( !$wgUser->isAllowed( 'autopatrol' ) ) {
+ $rc = RecentChange::newFromId( $rcid );
+ # Graceful error handling, as we've done before here...
+ # (If the recent change doesn't exist, then it doesn't matter whether
+ # the user is allowed to patrol it or not; nothing is going to happen
+ if( is_object( $rc ) && $wgUser->getName() == $rc->getAttribute( 'rc_user_text' ) ) {
+ # The user made this edit, and can't patrol it
+ # Tell them so, and then back off
+ $wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) );
+ $wgOut->addWikiText( wfMsgNoTrans( 'markedaspatrollederror-noautopatrol' ) );
+ $wgOut->returnToMain( false, $return );
+ return;
+ }
+ }
+
+ # Mark the edit as patrolled
+ RecentChange::markPatrolled( $rcid );
+ wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
+
+ # Inform the user
+ $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) );
+ $wgOut->addWikiText( wfMsgNoTrans( 'markedaspatrolledtext' ) );
+ $wgOut->returnToMain( false, $return );
}
/**
$rc->numberofWatchingusers = false;
return $rc;
}
+
+ /**
+ * Obtain the recent change with a given rc_id value
+ *
+ * @param $rcid rc_id value to retrieve
+ * @return RecentChange
+ */
+ public static function newFromId( $rcid ) {
+ $dbr =& wfGetDB( DB_SLAVE );
+ $res = $dbr->select( 'recentchanges', '*', array( 'rc_id' => $rcid ), __METHOD__ );
+ if( $res && $dbr->numRows( $res ) > 0 ) {
+ $row = $dbr->fetchObject( $res );
+ $dbr->freeResult( $res );
+ return self::newFromRow( $row );
+ } else {
+ return NULL;
+ }
+ }
# Accessors
$this->mExtra = array();
}
+ /**
+ * Get an attribute value
+ *
+ * @param $name Attribute name
+ * @return mixed
+ */
+ public function getAttribute( $name ) {
+ return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL;
+ }
/**
* Gets the end part of the diff URL associated with this object