mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-03 11:46:22 +00:00
Merge "Remove obsolete ReferenceTooltips gadget checks"
This commit is contained in:
commit
bb61d544f2
|
@ -61,10 +61,6 @@
|
||||||
"description": "@var string: Navigation popups gadget name",
|
"description": "@var string: Navigation popups gadget name",
|
||||||
"value": "Navigation_popups"
|
"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": {
|
"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",
|
"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"
|
"value": "mwApiPlain"
|
||||||
|
|
|
@ -115,14 +115,6 @@ class PopupsContext {
|
||||||
return $this->gadgetsIntegration->conflictsWithNavPopupsGadget( $user );
|
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
|
* Are Page previews visible on User Preferences Page
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,18 +32,11 @@ class PopupsGadgetsIntegration {
|
||||||
|
|
||||||
public const CONFIG_NAVIGATION_POPUPS_NAME = 'PopupsConflictingNavPopupsGadgetName';
|
public const CONFIG_NAVIGATION_POPUPS_NAME = 'PopupsConflictingNavPopupsGadgetName';
|
||||||
|
|
||||||
public const CONFIG_REFERENCE_TOOLTIPS_NAME = 'PopupsConflictingRefTooltipsGadgetName';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $navPopupsGadgetName;
|
private $navPopupsGadgetName;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $refTooltipsGadgetName;
|
|
||||||
|
|
||||||
private ?GadgetRepo $gadgetRepo;
|
private ?GadgetRepo $gadgetRepo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,8 +49,6 @@ class PopupsGadgetsIntegration {
|
||||||
) {
|
) {
|
||||||
$this->navPopupsGadgetName = $this->sanitizeGadgetName(
|
$this->navPopupsGadgetName = $this->sanitizeGadgetName(
|
||||||
$config->get( self::CONFIG_NAVIGATION_POPUPS_NAME ) );
|
$config->get( self::CONFIG_NAVIGATION_POPUPS_NAME ) );
|
||||||
$this->refTooltipsGadgetName = $this->sanitizeGadgetName(
|
|
||||||
$config->get( self::CONFIG_REFERENCE_TOOLTIPS_NAME ) );
|
|
||||||
$this->gadgetRepo = $gadgetRepo;
|
$this->gadgetRepo = $gadgetRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,27 +81,4 @@ class PopupsGadgetsIntegration {
|
||||||
}
|
}
|
||||||
return false;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,6 @@ class PopupsGadgetsIntegrationTest extends MediaWikiIntegrationTestCase {
|
||||||
private function getConfig( string $name = self::NAV_POPUPS_GADGET_NAME ): Config {
|
private function getConfig( string $name = self::NAV_POPUPS_GADGET_NAME ): Config {
|
||||||
return new HashConfig( [
|
return new HashConfig( [
|
||||||
PopupsGadgetsIntegration::CONFIG_NAVIGATION_POPUPS_NAME => $name,
|
PopupsGadgetsIntegration::CONFIG_NAVIGATION_POPUPS_NAME => $name,
|
||||||
PopupsGadgetsIntegration::CONFIG_REFERENCE_TOOLTIPS_NAME => $name,
|
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue