From b228db6f1d2de372a0439202a07697102f52ffa1 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 11 Feb 2006 12:28:50 +0000 Subject: [PATCH] Hide own edits from RC, mostly by Jason. No show/hide link by default, you need to add it in if you want it. --- RELEASE-NOTES | 1 + includes/SpecialRecentchanges.php | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7d47e9b036..86f2b33557 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -345,6 +345,7 @@ Special Pages: * (bug 3187) watchlist text refer to unexistent "Stop watching" action * Add block link and a link to the block log to Special:Contributions * Add contributions link to block log items +* Added optional "hide own edits" feature to Special:Recentchanges Misc.: * PHP 4.1 compatibility fix: don't use new_link parameter to mysql_connect diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index c4a6dea6a4..3a83d4a6ac 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -31,6 +31,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) { /* bool */ 'hidebots' => true, /* bool */ 'hideliu' => false, /* bool */ 'hidepatrolled' => false, + /* bool */ 'hidemyself' => false, /* text */ 'from' => '', /* text */ 'namespace' => null, /* bool */ 'invert' => false, @@ -51,9 +52,8 @@ function wfSpecialRecentchanges( $par, $specialPage ) { $limit = $wgRequest->getInt( 'limit', $limit ); /* order of selection: url > preferences > default */ - $hideminor = $wgRequest->getBool( 'hideminor', $wgUser->getOption( 'hideminor') ? true : $defaults['hideminor'] ); - - + $hideminor = $wgRequest->getBool( 'hideminor', $wgUser->getOption( 'hideminor') ? true : $defaults['hideminor'] ); + # As a feed, use limited settings only if( $feedFormat ) { global $wgFeedLimit; @@ -68,7 +68,8 @@ function wfSpecialRecentchanges( $par, $specialPage ) { $hidebots = $wgRequest->getBool( 'hidebots', $defaults['hidebots'] ); $hideliu = $wgRequest->getBool( 'hideliu', $defaults['hideliu'] ); $hidepatrolled = $wgRequest->getBool( 'hidepatrolled', $defaults['hidepatrolled'] ); - $from = $wgRequest->getVal( 'from', $defaults['from'] ); + $hidemyself = $wgRequest->getBool ( 'hidemyself', $defaults['hidemyself'] ); + $from = $wgRequest->getVal( 'from', $defaults['from'] ); # Get query parameters from path if( $par ) { @@ -80,6 +81,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) { if ( 'minor' == $bit ) $hideminor = 0; if ( 'hideliu' == $bit ) $hideliu = 1; if ( 'hidepatrolled' == $bit ) $hidepatrolled = 1; + if ( 'hidemyself' == $bit ) $hidemyself = 1; if ( is_numeric( $bit ) ) { $limit = $bit; @@ -128,8 +130,15 @@ function wfSpecialRecentchanges( $par, $specialPage ) { $hidem = $hideminor ? 'AND rc_minor=0' : ''; $hidem .= $hidebots ? ' AND rc_bot=0' : ''; - $hidem .= $hideliu ? ' AND rc_user=0' : ''; + $hidem .= ( $hideliu && !$hidemyself ) ? ' AND rc_user=0' : ''; $hidem .= $hidepatrolled ? ' AND rc_patrolled=0' : ''; + if ( $hidemyself ) { + if ( $wgUser->getID() ) { + $hidem .= ' AND rc_user <> '.$wgUser->getID(); + } else { + $hidem .= ' AND rc_user_text<>' . $dbr->addQuotes( $wgUser->getName() ); + } + } $hidem .= is_null( $namespace ) ? '' : ' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace; // This is the big thing! @@ -185,6 +194,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) { wfAppendToArrayIfNotDefault( 'hidebots', $hidebots, $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'hideliu', $hideliu, $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'hidepatrolled', $hidepatrolled, $defaults, $nondefaults); + wfAppendToArrayIfNotDefault( 'hidemyself', $hidemyself, $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'from', $from, $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'namespace', $namespace, $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'invert', $invert, $defaults, $nondefaults); @@ -420,7 +430,7 @@ function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' ) { * Used by Recentchangeslinked */ function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall = false, $minorLink = '', - $botLink = '', $liuLink = '', $patrLink = '' ) { + $botLink = '', $liuLink = '', $patrLink = '', $myselfLink = '' ) { if ($more != '') $more .= '&'; $cl = rcCountLink( 50, $days, $page, $more ) . ' | ' . rcCountLink( 100, $days, $page, $more ) . ' | ' . @@ -433,7 +443,7 @@ function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall rcDaysLink( $limit, 14, $page, $more ) . ' | ' . rcDaysLink( $limit, 30, $page, $more ) . ( $doall ? ( ' | ' . rcDaysLink( $limit, 0, $page, $more ) ) : '' ); - $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink ); + $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink, $myselfLink ); $note = wfMsg( 'rclinks', $cl, $dl, $shm ); return $note; } @@ -492,9 +502,10 @@ function rcOptionsPanel( $defaults, $nondefaults ) { array( 'hideliu' => 1-$options['hideliu'] ), $nondefaults); $patrLink = makeOptionsLink( $showhide[1-$options['hidepatrolled']], array( 'hidepatrolled' => 1-$options['hidepatrolled'] ), $nondefaults); - - $hl = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink ); - + $myselfLink = makeOptionsLink( $showhide[1-$options['hidemyself']], + array( 'hidemyself' => 1-$options['hidemyself'] ), $nondefaults); + $hl = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink, $myselfLink ); + // show from this onward link $now = $wgLang->timeanddate( wfTimestampNow(), true ); $tl = makeOptionsLink( $now, array( 'from' => wfTimestampNow()), $nondefaults ); -- 2.20.1