From bcbe6fc705bf8ab703851e7120857a4acdc9b459 Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Fri, 16 Jun 2023 14:19:50 -0700 Subject: [PATCH] Correct the logic for the ULS settings cog for Vector 2022 Bug: T315036 Change-Id: I9fe711cee57ee07dabba5c04f3c7faa5eb82a2c4 --- includes/Hooks.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index f2f506f2..32c84eb1 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -529,11 +529,21 @@ class Hooks implements return; } - // @todo: document what this block is for. - if ( $skin->getSkinName() !== 'vector-2022' && $this->config->get( 'ULSPosition' ) !== 'interlanguage' ) { + // The ULS settings cog is only needed on projects which show the ULS button in the sidebar + // e.g. it is shown in the personal menu + if ( $this->config->get( 'ULSPosition' ) !== 'interlanguage' ) { return; } + // For Vector 2022, the ULS settings cog is not needed for projects + // where a dedicated language button in the header (VectorLanguageInHeader is true). + if ( $skin->getSkinName() === 'vector-2022' ) { + $languageInHeaderConfig = $skin->getConfig()->get( 'VectorLanguageInHeader' ); + if ( $languageInHeaderConfig[ $skin->getUser()->isAnon() ? 'logged_out' : 'logged_in' ] ?? true ) { + return; + } + } + if ( !$this->isEnabled() ) { return; }