From 14aff8189cc2ce9486fcca709946069478a41cea Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Mon, 7 Oct 2024 20:03:03 +0200 Subject: [PATCH] Remove obsolete ReferenceTooltips gadget checks The checks are part of the Cite extension now and have no relevance for page previews. The config is also obsolete by now due to the copy in Cite and a mapping in mediawiki-config. See Ie6e8bc706235724494036c7f0d873f5c996c46e6 and Ia028c41f8aaa1c522dfc7c372e1ce51e40933a5e for reference. Bug: T362771 Change-Id: I51311a099b21c3c1af39bbfbde1d2c2044958421 --- extension.json | 4 --- includes/PopupsContext.php | 8 ----- includes/PopupsGadgetsIntegration.php | 32 ------------------- .../phpunit/PopupsGadgetsIntegrationTest.php | 1 - 4 files changed, 45 deletions(-) diff --git a/extension.json b/extension.json index 63d8c299c..bfa4de618 100644 --- a/extension.json +++ b/extension.json @@ -61,10 +61,6 @@ "description": "@var string: Navigation popups gadget name", "value": "Navigation_popups" }, - "PopupsConflictingRefTooltipsGadgetName": { - "description": "@var string: Name of a gadget that would cause duplicate reference preview popups. Known conflicting gadgets include \"ReferenceTooltips\", \"CiteTooltip\" alias \"RefTooltip\", \"ReferencePopups\", and \"tooltipRef\" (see T274353).", - "value": "ReferenceTooltips" - }, "PopupsGateway": { "description": "Which gateway to use for fetching Popups data. Available options: [mwApiPlain|restbasePlain|restbaseHTML]. Full and always up to date list is available in src/gateway/index.js", "value": "mwApiPlain" diff --git a/includes/PopupsContext.php b/includes/PopupsContext.php index 9d5abd256..1564368e4 100644 --- a/includes/PopupsContext.php +++ b/includes/PopupsContext.php @@ -115,14 +115,6 @@ class PopupsContext { return $this->gadgetsIntegration->conflictsWithNavPopupsGadget( $user ); } - /** - * @param User $user User whose gadgets settings are being checked - * @return bool - */ - public function conflictsWithRefTooltipsGadget( User $user ) { - return $this->gadgetsIntegration->conflictsWithRefTooltipsGadget( $user ); - } - /** * Are Page previews visible on User Preferences Page * diff --git a/includes/PopupsGadgetsIntegration.php b/includes/PopupsGadgetsIntegration.php index 1d4cd01b0..dc7483f87 100644 --- a/includes/PopupsGadgetsIntegration.php +++ b/includes/PopupsGadgetsIntegration.php @@ -32,18 +32,11 @@ class PopupsGadgetsIntegration { public const CONFIG_NAVIGATION_POPUPS_NAME = 'PopupsConflictingNavPopupsGadgetName'; - public const CONFIG_REFERENCE_TOOLTIPS_NAME = 'PopupsConflictingRefTooltipsGadgetName'; - /** * @var string */ private $navPopupsGadgetName; - /** - * @var string - */ - private $refTooltipsGadgetName; - private ?GadgetRepo $gadgetRepo; /** @@ -56,8 +49,6 @@ class PopupsGadgetsIntegration { ) { $this->navPopupsGadgetName = $this->sanitizeGadgetName( $config->get( self::CONFIG_NAVIGATION_POPUPS_NAME ) ); - $this->refTooltipsGadgetName = $this->sanitizeGadgetName( - $config->get( self::CONFIG_REFERENCE_TOOLTIPS_NAME ) ); $this->gadgetRepo = $gadgetRepo; } @@ -90,27 +81,4 @@ class PopupsGadgetsIntegration { } return false; } - - /** - * Check if Popups conflicts with Ref Tooltips Gadget - * If user enabled Ref Tooltip, Popups is unavailable - * - * @param User $user User whose gadget settings are checked - * @return bool - */ - public function conflictsWithRefTooltipsGadget( User $user ) { - if ( $this->gadgetRepo ) { - $match = array_search( $this->refTooltipsGadgetName, $this->gadgetRepo->getGadgetIds() ); - if ( $match !== false ) { - try { - return $this->gadgetRepo->getGadget( $this->refTooltipsGadgetName ) - ->isEnabled( $user ); - } catch ( \InvalidArgumentException $e ) { - return false; - } - } - } - return false; - } - } diff --git a/tests/phpunit/PopupsGadgetsIntegrationTest.php b/tests/phpunit/PopupsGadgetsIntegrationTest.php index d73f514c3..1d9698b47 100644 --- a/tests/phpunit/PopupsGadgetsIntegrationTest.php +++ b/tests/phpunit/PopupsGadgetsIntegrationTest.php @@ -58,7 +58,6 @@ class PopupsGadgetsIntegrationTest extends MediaWikiIntegrationTestCase { private function getConfig( string $name = self::NAV_POPUPS_GADGET_NAME ): Config { return new HashConfig( [ PopupsGadgetsIntegration::CONFIG_NAVIGATION_POPUPS_NAME => $name, - PopupsGadgetsIntegration::CONFIG_REFERENCE_TOOLTIPS_NAME => $name, ] ); }