Page MenuHomePhabricator

bug4488.patch

Authored By
bzimport
Nov 21 2014, 9:00 PM
Size
3 KB
Referenced Files
None
Subscribers
None

bug4488.patch

Index: includes/User.php
===================================================================
--- includes/User.php (revision 59439)
+++ includes/User.php (working copy)
@@ -65,6 +65,7 @@
'editwidth',
'watchcreations',
'watchdefault',
+ 'watchrollback',
'watchmoves',
'watchdeletion',
'minordefault',
Index: includes/Article.php
===================================================================
--- includes/Article.php (revision 59439)
+++ includes/Article.php (working copy)
@@ -2188,7 +2188,7 @@
return false;
}
if( wfRunHooks('WatchArticle', array(&$wgUser, &$this)) ) {
- $wgUser->addWatch( $this->mTitle );
+ $this->mTitle->watch();
return wfRunHooks('WatchArticleComplete', array(&$wgUser, &$this));
}
return false;
@@ -2225,7 +2225,7 @@
return false;
}
if( wfRunHooks('UnwatchArticle', array(&$wgUser, &$this)) ) {
- $wgUser->removeWatch( $this->mTitle );
+ $this->mTitle->unwatch();
return wfRunHooks('UnwatchArticleComplete', array(&$wgUser, &$this));
}
return false;
@@ -3011,11 +3011,15 @@
if( $wgUser->pingLimiter( 'rollback' ) || $wgUser->pingLimiter() ) {
$errors[] = array( 'actionthrottledtext' );
}
- # If there were errors, bail out now
- if( !empty( $errors ) )
- return $errors;
- return $this->commitRollback($fromP, $summary, $bot, $resultDetails);
+ if( empty( $errors ) ) {
+ $errors = $this->commitRollback( $fromP, $summary, $bot, $resultDetails );
+
+ if( empty( $errors ) && $wgUser->getOption( 'watchrollback' ) && !$this->mTitle->userIsWatching() ) {
+ $this->doWatch();
+ }
+ }
+ return $errors;
}
/**
Index: includes/Title.php
===================================================================
--- includes/Title.php (revision 59439)
+++ includes/Title.php (working copy)
@@ -1044,6 +1044,24 @@
}
/**
+ * Watch this page for $wgUser
+ */
+ public function watch() {
+ global $wgUser;
+ $wgUser->addWatch( $this );
+ $this->mWatched = true;
+ }
+
+ /**
+ * Unwatch this page for $wgUser
+ */
+ public function unwatch() {
+ global $wgUser;
+ $wgUser->removeWatch( $this );
+ $this->mWatched = false;
+ }
+
+ /**
* Can $wgUser perform $action on this page?
* @param $action \type{\string} action that permission needs to be checked for
* @param $doExpensiveQueries \type{\bool} Set this to false to avoid doing unnecessary queries.
Index: includes/DefaultSettings.php
===================================================================
--- includes/DefaultSettings.php (revision 59439)
+++ includes/DefaultSettings.php (working copy)
@@ -2705,6 +2705,7 @@
'watchlisthidepatrolled' => 0,
'watchcreations' => 0,
'watchdefault' => 0,
+ 'watchrollback' => 0,
'watchmoves' => 0,
'watchdeletion' => 0,
'noconvertlink' => 0,
Index: includes/Preferences.php
===================================================================
--- includes/Preferences.php (revision 59439)
+++ includes/Preferences.php (working copy)
@@ -889,7 +889,8 @@
$watchTypes = array(
'edit' => 'watchdefault',
'move' => 'watchmoves',
- 'delete' => 'watchdeletion'
+ 'delete' => 'watchdeletion',
+ 'rollback' => 'watchrollback'
);
// Kinda hacky
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 59439)
+++ languages/messages/MessagesEn.php (working copy)
@@ -626,6 +626,7 @@
'tog-editwidth' => 'Widen the edit box to fill the entire screen',
'tog-watchcreations' => 'Add pages I create to my watchlist',
'tog-watchdefault' => 'Add pages I edit to my watchlist',
+'tog-watchrollback' => 'Add pages I roll back to my watchlist',
'tog-watchmoves' => 'Add pages I move to my watchlist',
'tog-watchdeletion' => 'Add pages I delete to my watchlist',
'tog-minordefault' => 'Mark all edits minor by default',

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2110
Default Alt Text
bug4488.patch (3 KB)

Event Timeline