From 772059e915cc3e91e6fe3c11eb878e5101178bfa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 28 Feb 2014 19:29:11 +0100 Subject: [PATCH] SpecialRecentchanges: Don't use nonexistent messages for filter selector Extensions can defined additional filters, but don't need to define the corresponding messages. If they don't exist, just fall back to 'show' and 'hide'. This also fixes the double-escaping of selector link contents and adds missing entries to the list of messages used here. Follow-up to Ibbfc3cd0. Bug: 58449 Change-Id: Id323e3b7daced1e7b6b1e1add4e9e1bf7df05e4e --- includes/specials/SpecialRecentchanges.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index ed290191fa..f5a5206bcf 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -722,12 +722,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage { 'hidemyself' => 'rcshowhidemine' ); - // The following messages are also used as the link text itself: - // rcshowhideminor-show, rcshowhideminor-hide, - // rcshowhidebots-show, rcshowhideminor-hide, - // rcshowhideanons-show, rcshowhideanons-hide, - // rcshowhidepatr-show, rcshowhidepatr-hide, - // rcshowhidemine-show, rcshowhidemine-hide. $showhide = array( 'show', 'hide' ); foreach ( $this->getCustomFilters() as $key => $params ) { @@ -740,7 +734,18 @@ class SpecialRecentChanges extends ChangesListSpecialPage { $links = array(); foreach ( $filters as $key => $msg ) { - $link = $this->makeOptionsLink( $this->msg( $msg . '-' . $showhide[1 - $options[$key]] ), + // The following messages are used here: + // rcshowhideminor-show, rcshowhideminor-hide, rcshowhidebots-show, rcshowhidebots-hide, + // rcshowhideanons-show, rcshowhideanons-hide, rcshowhideliu-show, rcshowhideliu-hide, + // rcshowhidepatr-show, rcshowhidepatr-hide, rcshowhidemine-show, rcshowhidemine-hide. + $linkMessage = $this->msg( $msg . '-' . $showhide[1 - $options[$key]] ); + // Extensions can define additional filters, but don't need to define the corresponding + // messages. If they don't exist, just fall back to 'show' and 'hide'. + if ( !$linkMessage->exists() ) { + $linkMessage = $this->msg( $showhide[1 - $options[$key]] ); + } + + $link = $this->makeOptionsLink( $linkMessage->text(), array( $key => 1 - $options[$key] ), $nondefaults ); $links[] = $this->msg( $msg )->rawParams( $link )->escaped(); } -- 2.20.1