r13001 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13000‎ | r13001 | r13002 >
Date:12:28, 11 February 2006
Author:timstarling
Status:old
Tags:
Comment:
Hide own edits from RC, mostly by Jason. No show/hide link by default, you need to add it in if you want it.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialRecentchanges.php
@@ -31,6 +31,7 @@
3232 /* bool */ 'hidebots' => true,
3333 /* bool */ 'hideliu' => false,
3434 /* bool */ 'hidepatrolled' => false,
 35+ /* bool */ 'hidemyself' => false,
3536 /* text */ 'from' => '',
3637 /* text */ 'namespace' => null,
3738 /* bool */ 'invert' => false,
@@ -51,9 +52,8 @@
5253 $limit = $wgRequest->getInt( 'limit', $limit );
5354
5455 /* order of selection: url > preferences > default */
55 - $hideminor = $wgRequest->getBool( 'hideminor', $wgUser->getOption( 'hideminor') ? true : $defaults['hideminor'] );
56 -
57 -
 56+ $hideminor = $wgRequest->getBool( 'hideminor', $wgUser->getOption( 'hideminor') ? true : $defaults['hideminor'] );
 57+
5858 # As a feed, use limited settings only
5959 if( $feedFormat ) {
6060 global $wgFeedLimit;
@@ -68,7 +68,8 @@
6969 $hidebots = $wgRequest->getBool( 'hidebots', $defaults['hidebots'] );
7070 $hideliu = $wgRequest->getBool( 'hideliu', $defaults['hideliu'] );
7171 $hidepatrolled = $wgRequest->getBool( 'hidepatrolled', $defaults['hidepatrolled'] );
72 - $from = $wgRequest->getVal( 'from', $defaults['from'] );
 72+ $hidemyself = $wgRequest->getBool ( 'hidemyself', $defaults['hidemyself'] );
 73+ $from = $wgRequest->getVal( 'from', $defaults['from'] );
7374
7475 # Get query parameters from path
7576 if( $par ) {
@@ -80,6 +81,7 @@
8182 if ( 'minor' == $bit ) $hideminor = 0;
8283 if ( 'hideliu' == $bit ) $hideliu = 1;
8384 if ( 'hidepatrolled' == $bit ) $hidepatrolled = 1;
 85+ if ( 'hidemyself' == $bit ) $hidemyself = 1;
8486
8587 if ( is_numeric( $bit ) ) {
8688 $limit = $bit;
@@ -128,8 +130,15 @@
129131
130132 $hidem = $hideminor ? 'AND rc_minor=0' : '';
131133 $hidem .= $hidebots ? ' AND rc_bot=0' : '';
132 - $hidem .= $hideliu ? ' AND rc_user=0' : '';
 134+ $hidem .= ( $hideliu && !$hidemyself ) ? ' AND rc_user=0' : '';
133135 $hidem .= $hidepatrolled ? ' AND rc_patrolled=0' : '';
 136+ if ( $hidemyself ) {
 137+ if ( $wgUser->getID() ) {
 138+ $hidem .= ' AND rc_user <> '.$wgUser->getID();
 139+ } else {
 140+ $hidem .= ' AND rc_user_text<>' . $dbr->addQuotes( $wgUser->getName() );
 141+ }
 142+ }
134143 $hidem .= is_null( $namespace ) ? '' : ' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace;
135144
136145 // This is the big thing!
@@ -185,6 +194,7 @@
186195 wfAppendToArrayIfNotDefault( 'hidebots', $hidebots, $defaults, $nondefaults);
187196 wfAppendToArrayIfNotDefault( 'hideliu', $hideliu, $defaults, $nondefaults);
188197 wfAppendToArrayIfNotDefault( 'hidepatrolled', $hidepatrolled, $defaults, $nondefaults);
 198+ wfAppendToArrayIfNotDefault( 'hidemyself', $hidemyself, $defaults, $nondefaults);
189199 wfAppendToArrayIfNotDefault( 'from', $from, $defaults, $nondefaults);
190200 wfAppendToArrayIfNotDefault( 'namespace', $namespace, $defaults, $nondefaults);
191201 wfAppendToArrayIfNotDefault( 'invert', $invert, $defaults, $nondefaults);
@@ -420,7 +430,7 @@
421431 * Used by Recentchangeslinked
422432 */
423433 function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall = false, $minorLink = '',
424 - $botLink = '', $liuLink = '', $patrLink = '' ) {
 434+ $botLink = '', $liuLink = '', $patrLink = '', $myselfLink = '' ) {
425435 if ($more != '') $more .= '&';
426436 $cl = rcCountLink( 50, $days, $page, $more ) . ' | ' .
427437 rcCountLink( 100, $days, $page, $more ) . ' | ' .
@@ -433,7 +443,7 @@
434444 rcDaysLink( $limit, 14, $page, $more ) . ' | ' .
435445 rcDaysLink( $limit, 30, $page, $more ) .
436446 ( $doall ? ( ' | ' . rcDaysLink( $limit, 0, $page, $more ) ) : '' );
437 - $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink );
 447+ $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink, $myselfLink );
438448 $note = wfMsg( 'rclinks', $cl, $dl, $shm );
439449 return $note;
440450 }
@@ -492,9 +502,10 @@
493503 array( 'hideliu' => 1-$options['hideliu'] ), $nondefaults);
494504 $patrLink = makeOptionsLink( $showhide[1-$options['hidepatrolled']],
495505 array( 'hidepatrolled' => 1-$options['hidepatrolled'] ), $nondefaults);
496 -
497 - $hl = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink );
498 -
 506+ $myselfLink = makeOptionsLink( $showhide[1-$options['hidemyself']],
 507+ array( 'hidemyself' => 1-$options['hidemyself'] ), $nondefaults);
 508+ $hl = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink, $myselfLink );
 509+
499510 // show from this onward link
500511 $now = $wgLang->timeanddate( wfTimestampNow(), true );
501512 $tl = makeOptionsLink( $now, array( 'from' => wfTimestampNow()), $nondefaults );
Index: trunk/phase3/RELEASE-NOTES
@@ -345,6 +345,7 @@
346346 * (bug 3187) watchlist text refer to unexistent "Stop watching" action
347347 * Add block link and a link to the block log to Special:Contributions
348348 * Add contributions link to block log items
 349+* Added optional "hide own edits" feature to Special:Recentchanges
349350
350351 Misc.:
351352 * PHP 4.1 compatibility fix: don't use new_link parameter to mysql_connect

Status & tagging log