Create preference to watchlist pages after rollbacking
authorÉtienne Beaulé <beauleetienne0@gmail.com>
Tue, 15 Jul 2014 12:32:16 +0000 (08:32 -0400)
committerLegoktm <legoktm.wikipedia@gmail.com>
Wed, 30 Jul 2014 21:51:41 +0000 (21:51 +0000)
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

RELEASE-NOTES-1.24
includes/DefaultSettings.php
includes/Preferences.php
includes/actions/RollbackAction.php
includes/api/ApiRollback.php
languages/i18n/en.json
languages/i18n/qqq.json

index 79fa3bb..37a6950 100644 (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
index 7c7f6ab..7a87679 100644 (file)
@@ -4294,6 +4294,7 @@ $wgDefaultUserOptions = array(
        'watchlisthideown' => 0,
        'watchlisthidepatrolled' => 0,
        'watchmoves' => 0,
+       'watchrollback' => 0,
        'wllimit' => 250,
        'useeditwarning' => 1,
        'prefershttps' => 1,
index 1eddd25..084d6ab 100644 (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',
index 617f1c9..76d70d7 100644 (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 ) &&
index 80e09b6..1bba715 100644 (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(),
index 703d566..d506ad2 100644 (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",
index 698f246..981c5d8 100644 (file)
        "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}}",