From 777cd78136bcc0767e66f3fdca207707a1a49a18 Mon Sep 17 00:00:00 2001 From: dreamyjazz Date: Tue, 31 May 2022 18:41:16 +0100 Subject: [PATCH] Show namespace instead of SpecialAllPages in plaintext block log message Ensure that when constructing a plaintext block log message for a partial block that the namespace is shown. Currently because makePageLink in plaintext mode uses the page title and does not include the $html text, which is used in non- plaintext mode, it means that for namespace blocks the shown text is "Special:AllPages". There is no way to link to Special:AllPages with a specified namespace while in plaintext mode because the namespace query parameter cannot be included in the wikilink. This means that, if the page was still linked to, the link would just show all pages. As such, unless other patches are submitted to allow the namespace to be specified when linking through a wikilink, the link is best removed. The plaintext value of the namespace is used by the CheckUser extension, which is what the relevant bug reports issues with. Bug: T268156 Change-Id: Ic05ae1adf92cb806517226d74bf2edc9a89251cd --- includes/logging/BlockLogFormatter.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/logging/BlockLogFormatter.php b/includes/logging/BlockLogFormatter.php index 2a46d21cffc..8c7f8d45b10 100644 --- a/includes/logging/BlockLogFormatter.php +++ b/includes/logging/BlockLogFormatter.php @@ -90,9 +90,18 @@ class BlockLogFormatter extends LogFormatter { $text = (int)$ns === NS_MAIN ? $this->msg( 'blanknamespace' )->escaped() : htmlspecialchars( $this->context->getLanguage()->getFormattedNsText( $ns ) ); - $params = [ 'namespace' => $ns ]; - - return $this->makePageLink( SpecialPage::getTitleFor( 'Allpages' ), $params, $text ); + if ( $this->plaintext ) { + // Because the plaintext cannot link to the Special:AllPages + // link that is linked to in non-plaintext mode, just return + // the name of the namespace. + return $text; + } else { + return $this->makePageLink( + SpecialPage::getTitleFor( 'Allpages' ), + [ 'namespace' => $ns ], + $text + ); + } }, $namespaces ); $actions = $params[6]['actions'] ?? [];