From: Étienne Beaulé Date: Tue, 15 Jul 2014 12:32:16 +0000 (-0400) Subject: Create preference to watchlist pages after rollbacking X-Git-Tag: 1.31.0-rc.0~14655 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=b230bdce16d3c834610a41c29573d34c9b778256;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 79fa3bbb69..37a6950b58 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -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 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7c7f6ab65b..7a876796ce 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4294,6 +4294,7 @@ $wgDefaultUserOptions = array( 'watchlisthideown' => 0, 'watchlisthidepatrolled' => 0, 'watchmoves' => 0, + 'watchrollback' => 0, 'wllimit' => 250, 'useeditwarning' => 1, 'prefershttps' => 1, diff --git a/includes/Preferences.php b/includes/Preferences.php index 1eddd25b04..084d6ab2e5 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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', diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php index 617f1c9998..76d70d70af 100644 --- a/includes/actions/RollbackAction.php +++ b/includes/actions/RollbackAction.php @@ -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 ) && diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 80e09b689a..1bba715448 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -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(), diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 703d566e51..d506ad2371 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -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", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 698f246fc7..981c5d8c36 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -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}}",