From f30a8b4063b4fb1d9d1a22bf0785d63f274c3795 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Tue, 18 Apr 2006 00:37:40 +0000 Subject: [PATCH] Watchlist cleanup #1 * Hiding bots should now work * Cleaned up "panel" generation code to facilitate easier adding of items in the future * Set less restrictive range on default days setting in user preferences * Tweak messages to look a bit nicer * Add the show/hide bots thing to the user preferences --- RELEASE-NOTES | 1 + includes/DefaultSettings.php | 6 ------ includes/SpecialPreferences.php | 4 ++-- includes/SpecialWatchlist.php | 35 +++++++++++++-------------------- languages/Language.php | 1 + languages/Messages.php | 7 +++---- 6 files changed, 21 insertions(+), 33 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3523d3715c..b9143018d1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -93,6 +93,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5628) More translations for MessagesHr.php * (bug 5595) Localisation for Bosnian language (bs) * (bug 2910) Default view preferences for watchlists +* Add "hide bot edits from the watchlist" user preference == Compatibility == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index f3b8e0ba89..20bdeda5d3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1897,12 +1897,6 @@ $wgTranscludeCacheExpiry = 3600; */ $wgUseTrackbacks = false; -/** - * Enable filtering of robots in Special:Watchlist - */ - -$wgFilterRobotsWL = false; - /** * Enable filtering of categories in Recentchanges */ diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 6af866246b..83277628a9 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -265,7 +265,7 @@ class PreferencesForm { $wgUser->setOption( 'imagesize', $this->mImageSize ); $wgUser->setOption( 'thumbsize', $this->mThumbSize ); $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) ); - $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0.5, 5 ) ); + $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) ); # Set search namespace options foreach( $this->mSearchNs as $i => $value ) { @@ -853,7 +853,7 @@ class PreferencesForm { $wgOut->addHTML( ' ' ); $wgOut->addHTML( '' ); $wgOut->addHTML( '

' ); # Spacing - $wgOut->addHTML( $this->getToggles( array( 'watchlisthideown' ) ) ); + $wgOut->addHTML( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots' ) ) ); $wgOut->addHTML( '' ); diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index 890761d168..5c89a33aae 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -248,13 +248,9 @@ function wfSpecialWatchlist( $par ) { # Up estimate of watched items by 15% to compensate for talk pages... + # Toggles $andHideOwn = $hideOwn ? "AND (rc_user <> $uid)" : ''; - if( $wgFilterRobotsWL ) { - $andHideBotsOptional = $hideBots ? "AND (rc_bot = 0)" : ''; - } else { - $andHideBotsOptional = "AND rc_this_oldid=page_latest"; - } - + $andHideBots = $hideBots ? "AND (rc_bot = 0)" : ''; # Show watchlist header $header = ''; @@ -295,7 +291,7 @@ function wfSpecialWatchlist( $par ) { AND rc_timestamp > '$cutoff' AND rc_cur_id=page_id $andHideOwn - $andHideBotsOptional + $andHideBots $nameSpaceClause ORDER BY rc_timestamp DESC"; @@ -314,23 +310,20 @@ function wfSpecialWatchlist( $par ) { $wgOut->addHTML( "\n" . wlCutoffLinks( $days, 'Watchlist', $nondefaults ) . "
\n" ); - $sk = $wgUser->getSkin(); - $s = $sk->makeKnownLink( - $wgContLang->specialPage( 'Watchlist' ), - (0 == $hideOwn) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ), - wfArrayToCGI( array('hideOwn' => 1-$hideOwn ), $nondefaults ) ); - $wgOut->addHTML( wfMsgHtml( "wlhideshowown", $s ) ); - - if( $wgFilterRobotsWL ) { - $s = $sk->makeKnownLink( - $wgContLang->specialPage( 'Watchlist' ), - (0 == $hideBots) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ), - wfArrayToCGI( array('hideBots' => 1-$hideBots ), $nondefaults ) ); - $wgOut->addHTML( wfMsgHtml( "wlhideshowbots", " $s" ) ); + # Spit out some control panel links + $thisTitle = Title::makeTitle( NS_SPECIAL, 'Watchlist' ); + $skin = $wgUser->getSkin(); + $linkElements = array( 'hideOwn' => 'wlhideshowown', 'hideBots' => 'wlhideshowbots' ); + + foreach( $linkElements as $var => $msg ) { + $label = $$var == 0 ? wfMsgHtml( 'hide' ) : wfMsgHtml( 'show' ); + $linkBits = wfArrayToCGI( array( $var => 1 - $$var ), $nondefaults ); + $link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ); + $links[] = wfMsgHtml( $msg, $link ); } + $wgOut->addHTML( implode( ' | ', $links ) ); # Form for namespace filtering - $thisTitle = Title::makeTitle( NS_SPECIAL, 'Watchlist' ); $thisAction = $thisTitle->escapeLocalUrl(); $nsForm = "
\n"; $nsForm .= " "; diff --git a/languages/Language.php b/languages/Language.php index 067c8b32dd..6a2d2009da 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -163,6 +163,7 @@ $wgDateFormatsEn = array( 'autopatrol', 'forceeditsummary', 'watchlisthideown', + 'watchlisthidebots', ); /* private */ $wgBookstoreListEn = array( diff --git a/languages/Messages.php b/languages/Messages.php index bb6d94e206..3404f6a157 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -64,6 +64,7 @@ parent class in order maintain consistency across languages. 'tog-autopatrol' => 'Mark edits I make as patrolled', 'tog-forceeditsummary' => 'Prompt me when entering a blank edit summary', 'tog-watchlisthideown' => 'Hide my edits from the watchlist', +'tog-watchlisthidebots' => 'Hide bot edits from the watchlist', 'underline-always' => 'Always', 'underline-never' => 'Never', @@ -1096,10 +1097,8 @@ at the bottom of the screen (deleting a content page also deletes the accompanyi 'wlnote' => 'Below are the last $1 changes in the last $2 hours.', 'wlshowlast' => 'Show last $1 hours $2 days $3', 'wlsaved' => 'This is a saved version of your watchlist.', -'wlhideshowown' => '$1 my edits.', -'wlhideshowbots' => '$1 bot edits.', -'wlshow' => 'Show', -'wlhide' => 'Hide', +'wlhideshowown' => '$1 my edits', +'wlhideshowbots' => '$1 bot edits', 'enotif_mailer' => '{{SITENAME}} Notification Mailer', 'enotif_reset' => 'Mark all pages visited', -- 2.20.1