-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
robchurch@svn.wikimedia.org wrote:
Move all watchlist editing into WatchlistEditor class, integrating "raw editing" from ExportWatchlist extension, per Brion. Spiffed up the existing editor and "clear" interface; all three editors better integrated from a UI perspective.
Looks good!
$titles = $this->extractTitles( $request->getText( 'titles' ) );
$this->clearWatchlist( $user );
$this->watchTitles( $titles, $user );
$user->invalidateCache();
This raw edit save will reset the last-seen timestamps for all watched pages, which could hurt a bit for people using email notification.
Doing an array diff and only adding/removing the changed items should work cleaner for that case, plus save some DB activity when making small changes to a large watchlist.
[snip]
$rows[] = array(
'wl_user' => $user->getId(),
'wl_namespace' => ( $title->getNamespace() & ~1 ),
'wl_title' => $title->getDBkey(),
'wl_notificationtimestamp' => null,
);
$rows[] = array(
'wl_user' => $user->getId(),
'wl_namespace' => ( $title->getNamespace() | 1 ),
'wl_title' => $title->getDBkey(),
'wl_notificationtimestamp' => null,
);
This low-level code makes some surprises in corner cases. :)
If you pass a Special: or Media: title, it accepts them and treats them as an article-talk pair. Interwiki titles are also accepted, treated as normal pages.
Probably these unwatchable titles should get stripped out of the stream, either here or at the high-level UI end.
I'd also recommend moving the low-level DB routines over to WatchedItem, which IIRC already has some batch-change functions.
}
- }
- /**
* Show the standard watchlist editing form
*
* @param OutputPage $output
* @param User $user
*/
- private function showNormalForm( $output, $user ) {
if( ( $count = $this->showItemCount( $output, $user ) ) > 0 ) {
$self = SpecialPage::getTitleFor( 'Watchlist' );
$form = Xml::openElement( 'form', array( 'method' => 'post',
'action' => $self->getLocalUrl( 'action=edit' ) ) );
$form .= Xml::hidden( 'token', $user->editToken( 'watchlistedit' ) );
$form .= '<fieldset><legend>' . wfMsgHtml( 'watchlistedit-normal-legend' ) . '</legend>';
$form .= wfMsgExt( 'watchlistedit-normal-explain', 'parse' );
foreach( $this->getWatchlist( $user ) as $namespace => $pages ) {
$form .= '<h2>' . $this->getNamespaceHeading( $namespace ) . '</h2>';
$form .= '<ul>';
foreach( $pages as $dbkey => $redirect ) {
$title = Title::makeTitleSafe( $namespace, $dbkey );
$form .= $this->buildRemoveLine( $title, $redirect, $user->getSkin() );
The makeTitleSafe() reminds me of the possibility of invalid entries in the watchlist table; those may not roundtrip nicely through the raw edit form. Just something to consider... automatic cleanup (for instance when namespaces change in weird ways) might be appropriate.
+'watchlistedit-normal-explain' => 'Titles on your watchlist are shown below. To remove a title, check
- the box next to it, and click Remove Titles. You can also [[Special:Watchlist/raw|edit the raw list]],
- or [[Special:Watchlist/clear|remove all titles]].',
The mode links here feel buried in the UI text to me; it's not obvious to me that it's there. It might be interesting to try a more tab-like link here, maybe just simple links like on Special:Allmessages
- -- brion vibber (brion @ wikimedia.org)
On 05/07/07, Brion Vibber brion@wikimedia.org wrote:
This raw edit save will reset the last-seen timestamps for all watched pages, which could hurt a bit for people using email notification.
Doing an array diff and only adding/removing the changed items should work cleaner for that case, plus save some DB activity when making small changes to a large watchlist.
Done. I've also optimised for the case where users blank the box and hit submit to clear. Following the discussion we had in IRC after I did that, I've since changed the code to pass around strings internally, since they're a hell of a lot lighter than Title objects.
If you pass a Special: or Media: title, it accepts them and treats them as an article-talk pair. Interwiki titles are also accepted, treated as normal pages.
Dealt with; these titles are now ditched.
I'd also recommend moving the low-level DB routines over to WatchedItem, which IIRC already has some batch-change functions.
Will consider doing this in a moment...
The makeTitleSafe() reminds me of the possibility of invalid entries in the watchlist table; those may not roundtrip nicely through the raw edit form. Just something to consider... automatic cleanup (for instance when namespaces change in weird ways) might be appropriate.
We talked about this a little, and as I see it, there are two major issues; to make scripts such as maintenance/namespaceDupes.php handle the watchlist (and really, any other place where we're storing a namespace/key pair, though these less-important tables could be batched up and done in low priority mode or somesuch), and to possibly introduce some sort of quick watchlist sweep job which can be queued up if we "spot" something odd in passing.
The mode links here feel buried in the UI text to me; it's not obvious to me that it's there. It might be interesting to try a more tab-like link here, maybe just simple links like on Special:Allmessages
Added navigation links at the top of the page. I toyed with a list in the main body, but it didn't really look right, although that's just me. :)
I may clear up a few of the old messages and perhaps some of the new ones, yet.
Rob Church
wikitech-l@lists.wikimedia.org