Create preference to watchlist pages after rollbacking

This change adds a  preference in the 'watchlist' section to
automatically watchlist a page after rollbacking.

The setting is only visible, if the user has the 'rollback'-right.
I have removed the watch reverts function per advice by Vogone.

Bug: 4488
Change-Id: I3aa831c9c04d627684641af0ca5a332795c87062
This commit is contained in:
Étienne Beaulé 2014-07-15 08:32:16 -04:00 committed by Legoktm
parent cceb6895ac
commit b230bdce16
7 changed files with 23 additions and 1 deletions

View file

@ -138,6 +138,8 @@ production.
configurations can be changed with $wgPasswordConfig.
* Skins can now define custom styles for default ResourceLoader modules using
the $wgResourceModuleSkinStyles global. See the Vector skin for examples.
* (bug 4488) There is now a preference to watch pages where the user has
rollbacked an edit by default.
=== Bug fixes in 1.24 ===
* (bug 49116) Footer copyright notice is now always displayed in user language

View file

@ -4294,6 +4294,7 @@ $wgDefaultUserOptions = array(
'watchlisthideown' => 0,
'watchlisthidepatrolled' => 0,
'watchmoves' => 0,
'watchrollback' => 0,
'wllimit' => 250,
'useeditwarning' => 1,
'prefershttps' => 1,

View file

@ -989,10 +989,15 @@ class Preferences {
$watchTypes['read'] = 'watchcreations';
}
if ( $user->isAllowed( 'rollback' ) ) {
$watchTypes['rollback'] = 'watchrollback';
}
foreach ( $watchTypes as $action => $pref ) {
if ( $user->isAllowed( $action ) ) {
// Messages:
// tog-watchdefault, tog-watchmoves, tog-watchdeletion, tog-watchcreations
// tog-watchrollback
$defaultPreferences[$pref] = array(
'type' => 'toggle',
'section' => 'watchlist/advancedwatchlist',

View file

@ -39,6 +39,7 @@ class RollbackAction extends FormlessAction {
$details = null;
$request = $this->getRequest();
$user = $this->getUser();
$result = $this->page->doRollback(
$request->getVal( 'from' ),
@ -97,6 +98,11 @@ class RollbackAction extends FormlessAction {
$new = Linker::revUserTools( $target );
$this->getOutput()->addHTML( $this->msg( 'rollback-success' )->rawParams( $old, $new )
->parseAsBlock() );
if ( $user->getBoolOption( 'watchrollback' ) ) {
$user->addWatch( $this->page->getTitle(), WatchedItem::IGNORE_USER_RIGHTS );
}
$this->getOutput()->returnToMain( false, $this->getTitle() );
if ( !$request->getBool( 'hidediff', false ) &&

View file

@ -61,7 +61,13 @@ class ApiRollback extends ApiBase {
$this->dieUsageMsg( reset( $retval ) );
}
$this->setWatch( $params['watchlist'], $titleObj );
$watch = 'preferences';
if ( isset( $params['watchlist'] ) ) {
$watch = $params['watchlist'];
}
// Watch pages
$this->setWatch( $watch, $titleObj, 'watchrollback' );
$info = array(
'title' => $titleObj->getPrefixedText(),

View file

@ -17,6 +17,7 @@
"tog-watchdefault": "Add pages and files I edit to my watchlist",
"tog-watchmoves": "Add pages and files I move to my watchlist",
"tog-watchdeletion": "Add pages and files I delete to my watchlist",
"tog-watchrollback": "Add pages where I have performed a rollback to my watchlist",
"tog-minordefault": "Mark all edits minor by default",
"tog-previewontop": "Show preview before edit box",
"tog-previewonfirst": "Show preview on first edit",

View file

@ -179,6 +179,7 @@
"tog-watchdefault": "[[Special:Preferences]], tab 'Watchlist'. Offers user to add edited pages to watchlist. {{Gender}}",
"tog-watchmoves": "[[Special:Preferences]], tab 'Watchlist'. Offers user to add moved pages to watchlist. {{Gender}}",
"tog-watchdeletion": "[[Special:Preferences]], tab 'Watchlist'. Offers user to add deleted pages to watchlist. {{Gender}}",
"tog-watchrollback": "[[Special:Preferences]], tab 'Watchlist'. Offers user to add pages where the user has rollbacked an edit to watchlist. {{Gender}}",
"tog-minordefault": "[[Special:Preferences]], tab 'Edit'. Offers user to mark all edits minor by default. {{Gender}}",
"tog-previewontop": "Toggle option used in [[Special:Preferences]]. {{Gender}}",
"tog-previewonfirst": "Toggle option used in [[Special:Preferences]]. {{Gender}}",