r93833 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93832‎ | r93833 | r93834 >
Date:15:38, 3 August 2011
Author:flohack
Status:deferred
Tags:
Comment:
Removed the inversion checkbox, as it was quite useless IMHO; Fixed a bug introduced in r93829
Modified paths:
  • /trunk/extensions/CollabWatchlist/includes/SpecialCollabWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CollabWatchlist/includes/SpecialCollabWatchlist.php
@@ -25,7 +25,7 @@
2626 /**
2727 * Constructor
2828 */
29 - public function __construct(){
 29+ public function __construct() {
3030 //XXX That's nasty, SpecialWatchlist should have a corresponding constructor,
3131 // or expose the methods we need publicly
3232 SpecialPage::__construct( 'CollabWatchlist' );
@@ -149,7 +149,6 @@
150150
151151 # Get collabwatchlist value, if supplied, and prepare a WHERE fragment
152152 $collabWatchlist = $wgRequest->getIntOrNull( 'collabwatchlist' );
153 - $invert = $wgRequest->getBool( 'invert' );
154153 if ( !is_null( $collabWatchlist ) && $collabWatchlist !== 'all' ) {
155154 $collabWatchlist = intval( $collabWatchlist );
156155 }
@@ -190,7 +189,6 @@
191190 wfAppendToArrayIfNotDefault( 'hidePatrolled', (int)$hidePatrolled, $defaults, $nondefaults );
192191 wfAppendToArrayIfNotDefault( 'filterTags', $filterTags , $defaults, $nondefaults );
193192 wfAppendToArrayIfNotDefault( 'invertTags', $invertTags , $defaults, $nondefaults );
194 - wfAppendToArrayIfNotDefault( 'invert', $invert , $defaults, $nondefaults );
195193
196194 if ( $days <= 0 ) {
197195 $andcutoff = '';
@@ -361,7 +359,6 @@
362360 }
363361 $form .= Xml::checkLabel( wfMsg( 'collabwatchlistinverttags' ), 'invertTags', 'nsinvertTags', $invertTags ) . '<br />';
364362 $form .= CollabWatchlistChangesList::collabWatchlistSelector( $listIdsAndNames, $collabWatchlist, '', 'collabwatchlist', wfMsg( 'collabwatchlist' ) ) . '&nbsp;';
365 - $form .= Xml::checkLabel( wfMsg( 'invert' ), 'invert', 'nsinvert', $invert ) . '&nbsp;';
366363 $form .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</p>';
367364 $form .= Html::hidden( 'days', $days );
368365 if ( $hideMinor )
@@ -427,7 +424,7 @@
428425 $rc->numberofWatchingusers = 0;
429426 }
430427
431 - $tags = $this->wlTagsForRevision( $obj->rc_this_oldid, array( $collabWatchlist ), $invert );
 428+ $tags = $this->wlTagsForRevision( $obj->rc_this_oldid, array( $collabWatchlist ) );
432429 // if( isset($tags) ) {
433430 // // Filter recentchanges which contain unwanted tags
434431 // $tagNames = array();
@@ -468,19 +465,14 @@
469466 * - rrt_comment Collabwatchlist tag comment
470467 * @param $rev_id
471468 * @param $rl_ids
472 - * @param $invert
473469 * @return unknown_type
474470 */
475 - function wlTagsForRevision( $rev_id, $rl_ids = array(), $invert = false, $filterTags = array() ) {
 471+ function wlTagsForRevision( $rev_id, $rl_ids = array(), $filterTags = array() ) {
476472 // Some DB stuff
477473 $dbr = wfGetDB( DB_SLAVE );
478474 $cond = array();
479475 if ( isset( $rl_ids ) && !( count( $rl_ids ) == 1 && $rl_ids[0] == 0 ) ) {
480 - if ( $invert ) {
481 - $cond[] = "rl_id NOT IN (" . $dbr->makeList( $rl_ids ) . ")";
482 - } else {
483 - $cond = array( "rl_id" => $rl_ids );
484 - }
 476+ $cond = array( "rl_id" => $rl_ids );
485477 }
486478 if ( isset( $filterTags ) && count( $filterTags ) > 0 ) {
487479 $cond[] = "ct_tag not in (" . $dbr->makeList( $filterTags ) . ")";
@@ -580,7 +572,22 @@
581573 }
582574 return $clause;
583575 }
 576+
 577+ //XXX SpecialWatchlist should let us pass the page title
 578+ public static function showHideLink( $options, $message, $name, $value ) {
 579+ global $wgUser;
584580
 581+ $showLinktext = wfMsgHtml( 'show' );
 582+ $hideLinktext = wfMsgHtml( 'hide' );
 583+ $title = SpecialPage::getTitleFor( 'CollabWatchlist' );
 584+ $skin = $wgUser->getSkin();
 585+
 586+ $label = $value ? $showLinktext : $hideLinktext;
 587+ $options[$name] = 1 - (int) $value;
 588+
 589+ return wfMsgHtml( $message, $skin->linkKnown( $title, $label, array(), $options ) );
 590+ }
 591+
585592 /**
586593 * Runs $db->addQuotes() for each of the strings
587594 * @param $db Database: The db object to use

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93829Now inheriting from SpecialWatchlist to re-use some code from themflohack14:26, 3 August 2011

Status & tagging log