mediawiki-extensions-Popups/tests/node-qunit
Jon Robson 2c09fd1d1c Generalize settings code (attempt 2)
This reverts commit a6a65204c6.
to restore custom preview types.

-- Changes since revert
The previous patch accidentally removed the syncUserSettings
changeListener. This has now been restored with several modifications:
* We have a migrate script which rewrites existing localStorage settings
to the new system
* The existing save functions are generalized.

The changes since this patch are captured in
Ia73467799a9b535f7a3cf7268727c9fab7af0d7e

-- More information

A new REGISTER_SETTING action replaces the BOOT action for
registering settings. This allows custom preview types to be
associated with a setting. They do this by adding the enabled
property to the module they provide to mw.popups.register

Every time the new action is called, we refresh the settings
dialog UI with the new settings.

Previously the settings dialog was hardcoded, but now it is generated
from the registered preview types by deriving associated messages
and checking they exist, so by default custom types will not show
up in the settings.

Benefits:
* This change empowers us to add a setting for Math previews to allow
them to be enabled or disabled.
* Allows us to separate references as its own module

Additional notes:
* The syncUserSettings.js changeListener is no longer needed as the logic
for this is handled inside the "userSettings" change listener in response to
the "settings" reducer which is responding to
SETTINGS_CHANGE and REGISTER_SETTING actions.

Upon merging:
* https://www.mediawiki.org/wiki/Extension:Popups#Extensibility will be
updated to detail how a setting can be registered.

Bug: T334261
Bug: T326692

Change-Id: Ie17d622870511ac9730fc9fa525698fc3aa0d5b6
2024-01-09 17:24:09 -08:00
..
changeListeners Generalize settings code (attempt 2) 2024-01-09 17:24:09 -08:00
gateway Prefer native JavaScript to jQuery 2023-05-21 16:53:50 +00:00
instrumentation Remove Popups instrumentation 2021-07-29 17:01:01 +00:00
integrations Allow to disable/enable popup types individually 2021-04-15 11:30:36 +02:00
preview TypeError: n.closest is not a function 2023-07-10 11:48:40 -07:00
reducers Generalize settings code (attempt 2) 2024-01-09 17:24:09 -08:00
ui Generalize settings code (attempt 2) 2024-01-09 17:24:09 -08:00
.eslintrc.json build: Update linters 2023-11-09 11:36:08 +00:00
actions.test.js Generalize settings code (attempt 2) 2024-01-09 17:24:09 -08:00
bracketedPixelRatio.test.js
changeListener.test.js build: Update eslint-config-wikimedia to 0.22.1 2022-02-28 13:18:24 +00:00
container.test.js build: Update eslint-config-wikimedia to 0.22.1 2022-02-28 13:18:24 +00:00
counts.test.js build: Update eslint-config-wikimedia to 0.22.1 2022-02-28 13:18:24 +00:00
experiments.test.js build: Update eslint-config-wikimedia to 0.22.1 2022-02-28 13:18:24 +00:00
formatter.test.js Remove obsolete mediaWiki and jQuery aliases 2019-10-22 09:30:46 +02:00
integration.test.js Allow to disable/enable popup types individually 2021-04-15 11:30:36 +02:00
isPagePreviewsEnabled.test.js Generalize settings code (attempt 2) 2024-01-09 17:24:09 -08:00
isReferencePreviewsEnabled.test.js Generalize settings code (attempt 2) 2024-01-09 17:24:09 -08:00
previewBehavior.test.js build: Update eslint-config-wikimedia to 0.22.1 2022-02-28 13:18:24 +00:00
run.js build: Update eslint-config-wikimedia to 0.22.1 2022-02-28 13:18:24 +00:00
setUserConfigFlags.test.js Remove all BetaFeature code from ReferencePreviews 2023-11-24 13:07:46 +01:00
stubs.js IP masked users use localStorage for settings 2023-06-14 08:16:50 -07:00
title.test.js build: Upgrade eslint-config-wikimedia from 0.17.0 to 0.20.0 2021-05-03 12:31:52 -07:00
userSettings.test.js Generalize settings code (attempt 2) 2024-01-09 17:24:09 -08:00
wait.test.js Fixes flakey test: it should resolve after waiting 2023-05-09 10:43:56 -07:00