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
This commit is contained in:
WMDE-Fisch 2024-10-07 20:03:03 +02:00
parent a3af7c91b5
commit 14aff8189c
4 changed files with 0 additions and 45 deletions

View file

@ -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"

View file

@ -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
*

View file

@ -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;
}
}

View file

@ -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,
] );
}