r52772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52771‎ | r52772 | r52773 >
Date:09:11, 5 July 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
* (bug 19442) Show/hide options on watchlist only work once
* Regression is probably since r51572
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -252,108 +252,17 @@
253253
254254 $cutofflinks = "\n" . wlCutoffLinks( $days, 'Watchlist', $nondefaults ) . "<br />\n";
255255
256 - # Spit out some control panel links
257256 $thisTitle = SpecialPage::getTitleFor( 'Watchlist' );
258 - $skin = $wgUser->getSkin();
259257
260 - $showLinktext = wfMsgHtml( 'show' );
261 - $hideLinktext = wfMsgHtml( 'hide' );
262 - # Hide/show minor edits
263 - $label = $hideMinor ? $showLinktext : $hideLinktext;
264 - $linkBits = array_merge(
265 - array( 'hideMinor' => 1 - (int)$hideMinor ),
266 - $nondefaults
267 - );
268 - $links[] = wfMsgHtml(
269 - 'rcshowhideminor',
270 - $skin->linkKnown(
271 - $thisTitle,
272 - $label,
273 - array(),
274 - $linkBits
275 - )
276 - );
 258+ # Spit out some control panel links
 259+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhideminor', 'hideMinor', $hideMinor );
 260+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhidebots', 'hideBots', $hideBots );
 261+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhideanons', 'hideAnons', $hideAnons );
 262+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhideliu', 'hideLiu', $hideLiu );
 263+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhidemine', 'hideOwn', $hideOwn );
277264
278 - # Hide/show bot edits
279 - $label = $hideBots ? $showLinktext : $hideLinktext;
280 - $linkBits = array_merge(
281 - array( 'hideBots' => 1 - (int)$hideBots ),
282 - $nondefaults
283 - );
284 - $links[] = wfMsgHtml(
285 - 'rcshowhidebots',
286 - $skin->linkKnown(
287 - $thisTitle,
288 - $label,
289 - array(),
290 - $linkBits
291 - )
292 - );
293 -
294 - # Hide/show anonymous edits
295 - $label = $hideAnons ? $showLinktext : $hideLinktext;
296 - $linkBits = array_merge(
297 - array( 'hideAnons' => 1 - (int)$hideAnons ),
298 - $nondefaults
299 - );
300 - $links[] = wfMsgHtml(
301 - 'rcshowhideanons',
302 - $skin->linkKnown(
303 - $thisTitle,
304 - $label,
305 - array(),
306 - $linkBits
307 - )
308 - );
309 -
310 - # Hide/show logged in edits
311 - $label = $hideLiu ? $showLinktext : $hideLinktext;
312 - $linkBits = array_merge(
313 - array( 'hideLiu' => 1 - (int)$hideLiu ),
314 - $nondefaults
315 - );
316 - $links[] = wfMsgHtml(
317 - 'rcshowhideliu',
318 - $skin->linkKnown(
319 - $thisTitle,
320 - $label,
321 - array(),
322 - $linkBits
323 - )
324 - );
325 -
326 - # Hide/show own edits
327 - $label = $hideOwn ? $showLinktext : $hideLinktext;
328 - $linkBits = array_merge(
329 - array( 'hideOwn' => 1 - (int)$hideOwn ),
330 - $nondefaults
331 - );
332 - $links[] = wfMsgHtml(
333 - 'rcshowhidemine',
334 - $skin->linkKnown(
335 - $thisTitle,
336 - $label,
337 - array(),
338 - $linkBits
339 - )
340 - );
341 -
342 - # Hide/show patrolled edits
343265 if( $wgUser->useRCPatrol() ) {
344 - $label = $hidePatrolled ? $showLinktext : $hideLinktext;
345 - $linkBits = array_merge(
346 - array( 'hidePatrolled' => 1 - (int)$hidePatrolled ),
347 - $nondefaults
348 - );
349 - $links[] = wfMsgHtml(
350 - 'rcshowhidepatr',
351 - $skin->linkKnown(
352 - $thisTitle,
353 - $label,
354 - array(),
355 - $linkBits
356 - )
357 - );
 266+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhidepatr', 'hidePatrolled', $hidePatrolled );
358267 }
359268
360269 # Namespace filter and put the whole form together.
@@ -439,6 +348,21 @@
440349 $wgOut->addHTML( $s );
441350 }
442351
 352+function wlShowHideLink( $options, $message, $name, $value ) {
 353+ global $wgUser;
 354+
 355+ $showLinktext = wfMsgHtml( 'show' );
 356+ $hideLinktext = wfMsgHtml( 'hide' );
 357+ $title = SpecialPage::getTitleFor( 'Watchlist' );
 358+ $skin = $wgUser->getSkin();
 359+
 360+ $label = $value ? $showLinktext : $hideLinktext;
 361+ $options[$name] = 1 - (int) $value;
 362+
 363+ return wfMsgHtml( $message, $skin->linkKnown( $title, $label, array(), $options ) );
 364+}
 365+
 366+
443367 function wlHoursLink( $h, $page, $options = array() ) {
444368 global $wgUser, $wgLang, $wgContLang;
445369
Index: trunk/phase3/RELEASE-NOTES
@@ -228,6 +228,7 @@
229229 and attempted to upload with the source name. Now warns about not having an
230230 extension (since 0.ext is perfectly valid)
231231 * (bug 19468) Enotif preferences are now only displayed when they are turned on
 232+* (bug 19442) Show/hide options on watchlist only work once
232233
233234 == API changes in 1.16 ==
234235

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r51572* replace use of deprecated makeKnownLinkObj() by linkKnown() in core special...siebrand18:45, 7 June 2009

Status & tagging log