From: Aaron Schulz Date: Sun, 12 Oct 2008 17:31:03 +0000 (+0000) Subject: (bug 15946) Add hidepatrolled option to Special:Watchlist X-Git-Tag: 1.31.0-rc.0~44778 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=7828f62a2452dc522af63cf9afa81863b52f7c12;p=lhc%2Fweb%2Fwiklou.git (bug 15946) Add hidepatrolled option to Special:Watchlist --- diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index ccdc722977..6d7d6af956 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -22,7 +22,8 @@ function wfSpecialWatchlist( $par ) { # Anons don't get a watchlist if( $wgUser->isAnon() ) { $wgOut->setPageTitle( wfMsg( 'watchnologin' ) ); - $llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() ); + $llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), + wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() ); $wgOut->addHtml( wfMsgWikiHtml( 'watchlistanontext', $llink ) ); return; } @@ -52,6 +53,7 @@ function wfSpecialWatchlist( $par ) { /* bool */ 'hideBots' => (int)$wgUser->getBoolOption( 'watchlisthidebots' ), /* bool */ 'hideAnons' => (int)$wgUser->getBoolOption( 'watchlisthideanons' ), /* bool */ 'hideLiu' => (int)$wgUser->getBoolOption( 'watchlisthideliu' ), + /* bool */ 'hidePatrolled' => (int)$wgUser->getBoolOption( 'watchlisthidepatrolled' ), // TODO /* bool */ 'hideOwn' => (int)$wgUser->getBoolOption( 'watchlisthideown' ), /* ? */ 'namespace' => 'all', /* ? */ 'invert' => false, @@ -67,6 +69,7 @@ function wfSpecialWatchlist( $par ) { $prefs['hideanons'] = $wgUser->getBoolOption( 'watchlisthideanon' ); $prefs['hideliu'] = $wgUser->getBoolOption( 'watchlisthideliu' ); $prefs['hideown' ] = $wgUser->getBoolOption( 'watchlisthideown' ); + $prefs['hidepatrolled' ] = $wgUser->getBoolOption( 'watchlisthidepatrolled' ); # Get query variables $days = $wgRequest->getVal( 'days' , $prefs['days'] ); @@ -75,6 +78,7 @@ function wfSpecialWatchlist( $par ) { $hideAnons = $wgRequest->getBool( 'hideAnons', $prefs['hideanons'] ); $hideLiu = $wgRequest->getBool( 'hideLiu' , $prefs['hideliu'] ); $hideOwn = $wgRequest->getBool( 'hideOwn' , $prefs['hideown'] ); + $hidePatrolled = $wgRequest->getBool( 'hidePatrolled' , $prefs['hidepatrolled'] ); # Get namespace value, if supplied, and prepare a WHERE fragment $nameSpace = $wgRequest->getIntOrNull( 'namespace' ); @@ -121,6 +125,7 @@ function wfSpecialWatchlist( $par ) { wfAppendToArrayIfNotDefault( 'hideLiu' , (int)$hideLiu , $defaults, $nondefaults ); wfAppendToArrayIfNotDefault( 'hideOwn' , (int)$hideOwn , $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'namespace', $nameSpace , $defaults, $nondefaults); + wfAppendToArrayIfNotDefault( 'hidePatrolled', (int)$hidePatrolled, $defaults, $nondefaults ); $hookSql = ""; if( ! wfRunHooks('BeforeWatchlist', array($nondefaults, $wgUser, &$hookSql)) ) { @@ -158,6 +163,7 @@ function wfSpecialWatchlist( $par ) { $andHideMinor = $hideMinor ? "AND (rc_minor = 0)" : ''; $andHideLiu = $hideLiu ? "AND (rc_user = 0)" : ''; $andHideAnons = $hideAnons ? "AND (rc_user != 0)" : ''; + $andHidePatrolled = $hidePatrolled ? "AND (rc_patrolled != 1)" : ''; # Toggle watchlist content (all recent edits or just the latest) if( $wgUser->getOption( 'extendwatchlist' )) { @@ -211,6 +217,7 @@ function wfSpecialWatchlist( $par ) { $andHideMinor $andHideLiu $andHideAnons + $andHidePatrolled $nameSpaceClause $hookSql ORDER BY rc_timestamp DESC @@ -267,6 +274,11 @@ function wfSpecialWatchlist( $par ) { $label = $hideOwn ? wfMsgHtml( 'watchlist-show-own' ) : wfMsgHtml( 'watchlist-hide-own' ); $linkBits = wfArrayToCGI( array( 'hideOwn' => 1 - (int)$hideOwn ), $nondefaults ); $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ); + + # Hide/show patrolled edits + $label = $hidePatrolled ? wfMsgHtml( 'watchlist-show-patrolled' ) : wfMsgHtml( 'watchlist-hide-patrolled' ); + $linkBits = wfArrayToCGI( array( 'hidePatrolled' => 1 - (int)$hidePatrolled ), $nondefaults ); + $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ); # Namespace filter and put the whole form together. $form .= $wlInfo; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 90f99d57ee..e5d9b19656 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -3734,4 +3734,8 @@ Input the username or IP to get a list of pages to delete.', 'nuke-submit-delete' => 'Delete selected', 'right-nuke' => 'Mass delete pages', +# Unknown messages +'watchlist-hide-patrolled' => 'Hide patrolled edits', +'watchlist-show-patrolled' => 'Show patrolled edits', + ); diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 9941640b32..d32290df7a 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1515,6 +1515,8 @@ $wgMessageStructure = array( 'watchlist-hide-anons', 'watchlist-show-liu', 'watchlist-hide-liu', + 'watchlist-show-patrolled', + 'watchlist-hide-patrolled', 'watchlist-options', ), 'watching' => array(