Last modified: 2014-08-03 16:03:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T6488, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 4488 - Watch rollbacks
Watch rollbacks
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Watchlist (Other open bugs)
unspecified
All All
: Normal enhancement with 2 votes (vote)
: 1.24.0 release
Assigned To: Étienne Beaulé
:
: 17481 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-04 23:41 UTC by Sam Korn
Modified: 2014-08-03 16:03 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Proposed patch: Add user preference 'watchrollback' (4.78 KB, patch)
2009-02-17 17:25 UTC, P.Copp
Details
Updated patch for new pref system (3.92 KB, patch)
2009-12-02 23:46 UTC, P.Copp
Details

Description Sam Korn 2006-01-04 23:41:44 UTC
I would like to be able to automatically watchlist all the pages that I rollback
or delete.  Is this possible?
Comment 1 Rob Church 2006-12-16 21:44:58 UTC
Watching deletions added in r18381.
Comment 2 Rob Church 2007-01-06 18:01:51 UTC
I'm inclined to make rollback reuse the existing "watchdefault" preference,
since it's a special case of editing, but I suspect there'll be an uproar if
people's watchlists get flooded. Opinions?
Comment 3 Aaron Schulz 2007-01-06 18:12:45 UTC
I'd rather it be seperate, as some people do a good deal of RC patrol reverting
random vandalism but also make normal, slower, significant edits to pages they
care about, and it could indeed cause flooding.
Comment 4 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-01-07 00:21:30 UTC
And watchdefault can be manually overridden on the edit page with a checkbox,
which it presumably couldn't for rollback.
Comment 5 Siebrand Mazeland 2009-02-02 12:34:21 UTC
Changed component to "Watchlist"
Comment 6 P.Copp 2009-02-14 18:29:06 UTC
*** Bug 17481 has been marked as a duplicate of this bug. ***
Comment 7 P.Copp 2009-02-17 17:25:24 UTC
Created attachment 5823 [details]
Proposed patch: Add user preference 'watchrollback'

I assume, nobody is currently working on this, but as it seems quite straightforward to implement, I gave it a try.

Per comment #3 and #4 this patch adds a separate user preference for watching rolled back pages automatically. To make the display page after the rollback work properly, I had to add the methods watch() and unwatch() to the Title class, so $wgTitle->userIsWatching() gives the correct result afterwards. Actually there are some more places, that call $wgUser->addWatch( $title ) which could be replaced now by $title->watch(), but I didn't want to add too much clutter to the patch, so I left it for now.

Of course, any comments are appreciated.
Comment 8 Andrew Garrett 2009-03-04 06:17:05 UTC
Proposed patch seems to include a strange movement of watch/unwatch logic to the Title object. This doesn't make sense, because you watch the article, not the title.

-		# 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;

I think I like the early bail-out better. It avoids the clutter of checking empty($errors).

Also, you should check count($errors)==0, not empty($errors). empty() is used for a cast to bool with warnings suppressed. If you didn't want to do that, you should use count() explicitly.

It would be cool if you could work the 'create' toggle into the rest of the logic in Preferences, which is quite elegant compared to the current version.

Otherwise, the patch is pretty good. I may fix this stuff up over the coming days and commit it, if you don't get to it first.
Comment 9 P.Copp 2009-12-02 23:46:56 UTC
Created attachment 6853 [details]
Updated patch for new pref system

Oops, didn't realize someone commented on this one :D

(In reply to comment #8)
> Proposed patch seems to include a strange movement of watch/unwatch logic to
> the Title object. This doesn't make sense, because you watch the article, not
> the title.
>
It's rather a small addition than a move. The problem is that the Title object caches, whether the page is watched or not in its member ->mWatched. Currenty, when we watch/unwatch a page, this member is not updated, so any following calls of $title->userIsWatching() will return the wrong result.
So I changed the calls from $wgUser->addWatch( $title ) to $title->watch(), which will update the member var and call $wgUser->addWatch( $this ) itself.


> -               # 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;
> 
> I think I like the early bail-out better. It avoids the clutter of checking
> empty($errors).
> 
I moved the second if-Statement into the first one now, so I think there shouldn't be a difference anymore.

> Also, you should check count($errors)==0, not empty($errors). empty() is used
> for a cast to bool with warnings suppressed. If you didn't want to do that, you
> should use count() explicitly.
The existing code uses empty, so I didn't really want to change that.

> 
> It would be cool if you could work the 'create' toggle into the rest of the
> logic in Preferences, which is quite elegant compared to the current version.
>
With the new pref system this was even easier :)
Comment 10 John Du Hart 2011-08-31 23:29:30 UTC
Thank for submitting a patch to MediaWiki. I've reviewed the patch, and I don't think moving watch functions into the Title class is the best move here. It would be preferred to update the value of $mWatched from the User class.
Comment 11 db [inactive,noenotif] 2014-04-04 19:44:35 UTC
FYI: The Extension Echo does this with rollbacks and undos.
Comment 12 Jackmcbarn 2014-04-04 20:04:11 UTC
(In reply to db from comment #11)
> FYI: The Extension Echo does this with rollbacks and undos.

I don't think it does.
Comment 13 db [inactive,noenotif] 2014-04-05 14:26:30 UTC
When visiting the preferences page [[Special:Preferences#mw-prefsection-echo]] there is a option "Edit revert" with the tooltip "Notify me when someone reverts an edit I made, by using the undo or rollback tool.", which I mention.

It is not directly a watch, but you will get a echo ping and can see the rollback/undo. Not perfectly what was requested, but thats why I only added it as info, not changed the state.
Comment 14 Jackmcbarn 2014-04-05 15:12:30 UTC
He's asking for pages that he rolls back to be added to his watchlist, not to be told when someone rolls him back.
Comment 15 Gerrit Notification Bot 2014-07-15 13:11:40 UTC
Change 146440 had a related patch set uploaded by Ebe123:
Create preferences to watchlist pages after rollbacking and undoing

https://gerrit.wikimedia.org/r/146440
Comment 16 Gerrit Notification Bot 2014-07-30 22:19:10 UTC
Change 146440 merged by Legoktm:
Create preference to watchlist pages after rollbacking

https://gerrit.wikimedia.org/r/146440
Comment 17 Étienne Beaulé 2014-07-30 22:24:07 UTC
I hope it's fixed now. (And it should be)
Comment 18 Nemo 2014-08-03 16:03:13 UTC
Thanks for fixing this, it would have fit well in https://www.mediawiki.org/wiki/MediaWiki_1.23#Notifications :-)
This also makes it easier for sysadmins to enable "watchdefault" by default if they wish.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links