Sort out user rights when patrolling. If a user has the "autopatrol" right, then their edits are auto-marked as patrolled. If a user *doesn't* have this right, then they can't mark their own edits as patrolled in the normal fashion.
This commit is contained in:
parent
7197f044f5
commit
cb8b609a39
5 changed files with 73 additions and 16 deletions
|
|
@ -345,8 +345,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
* 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
|
||||
|
|
@ -373,6 +371,11 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
* (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 ==
|
||||
|
||||
|
|
|
|||
|
|
@ -1340,7 +1340,7 @@ class Article {
|
|||
$revisionId );
|
||||
|
||||
# Mark as patrolled if the user can do so
|
||||
if( $wgUser->isAllowed( 'patrol' ) ) {
|
||||
if( $wgUser->isAllowed( 'autopatrol' ) ) {
|
||||
RecentChange::markPatrolled( $rcid );
|
||||
}
|
||||
}
|
||||
|
|
@ -1401,7 +1401,7 @@ class Article {
|
|||
$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 );
|
||||
}
|
||||
}
|
||||
|
|
@ -1461,7 +1461,7 @@ class Article {
|
|||
*/
|
||||
function markpatrolled() {
|
||||
global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser;
|
||||
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
||||
$wgOut->setRobotPolicy( 'noindex,nofollow' );
|
||||
|
||||
# Check RC patrol config. option
|
||||
if( !$wgUseRCPatrol ) {
|
||||
|
|
@ -1475,20 +1475,45 @@ class Article {
|
|||
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' ) );
|
||||
if( !$rcid ) {
|
||||
$wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
|
||||
return;
|
||||
}
|
||||
|
||||
# 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;
|
||||
}
|
||||
$rcTitle = SpecialPage::getTitleFor( 'Recentchanges' );
|
||||
$wgOut->returnToMain( false, $rcTitle->getPrefixedText() );
|
||||
}
|
||||
else {
|
||||
$wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
|
||||
}
|
||||
|
||||
# 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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -935,6 +935,7 @@ $wgGroupPermissions['sysop']['import'] = true;
|
|||
$wgGroupPermissions['sysop']['importupload'] = true;
|
||||
$wgGroupPermissions['sysop']['move'] = true;
|
||||
$wgGroupPermissions['sysop']['patrol'] = true;
|
||||
$wgGroupPermissions['sysop']['autopatrol'] = true;
|
||||
$wgGroupPermissions['sysop']['protect'] = true;
|
||||
$wgGroupPermissions['sysop']['proxyunbannable'] = true;
|
||||
$wgGroupPermissions['sysop']['rollback'] = true;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,24 @@ class RecentChange
|
|||
$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
|
||||
|
||||
|
|
@ -449,6 +467,15 @@ class RecentChange
|
|||
$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
|
||||
|
|
|
|||
|
|
@ -2117,6 +2117,7 @@ All transwiki import actions are logged at the [[Special:Log/import|import log]]
|
|||
'rcpatroldisabledtext' => "The Recent Changes Patrol feature is currently disabled.",
|
||||
'markedaspatrollederror' => "Cannot mark as patrolled",
|
||||
'markedaspatrollederrortext' => "You need to specify a revision to mark as patrolled.",
|
||||
'markedaspatrollederror-noautopatrol' => 'You are not allowed to mark your own changes as patrolled.',
|
||||
|
||||
# Monobook.js: tooltips and access keys for monobook
|
||||
'Monobook.js' => '/* tooltips and access keys */
|
||||
|
|
|
|||
Loading…
Reference in a new issue