Commit graph

2970 commits

Author SHA1 Message Date
WMDE-Fisch 694b96a19f Set a global when reference previews are visible.
Used for tracking baseline stats in the Cite extension.

Also fixed the wireing of the Reference Preview type constant so
that the settings can be tracked. Not sure where this should go
best in the new code.

Bug: T353798
Change-Id: I1c434f0098ae23bd62256686a658e3d5ef7f70b9
2024-01-17 16:19:09 -08:00
WMDE-Fisch e15e2c4d14 Increase test coverage
More of a random thing done to increase the coverage a bit because
there are upcomming features that seem to be hard to test.

- Found one test case in reference previews that was configured
  wrongly

- Adding some sanity checks to the settingsDialogRender test

Change-Id: I95d3c6f30388b2dcc76b018d5dc0f958d06aad91
2024-01-16 10:44:53 +00:00
Jon Robson 381f8f5f7d Reduce bundlesize of reference previews by making it use stable APIs
This is a precursor to moving the code out to the Cite extension.

This can be squashed into parent commit or merged at same time.

I've kept the two patches separate to make them easier to review.

Bug: T326692
Change-Id: I50dbf28a1078df6c73fd0fbf77480488dd82c7b3
2024-01-16 11:44:07 +01:00
Jon Robson 59c6b8e88f Reference previews should use Popups registration
* Adds a new webpack entry point for references previews
* Reference related code in src/index.js is moved to new
file resources/ext.popups.referencePreviews/index.js

The changes:
* References previews now in its own module ext.popups.referencePreviews
* Loaded via getCustomPopupTypes
* OWNERS.md files make clear which team owns which part of the code.

Bug: T326692
Change-Id: Iea8a5b9221c0b1fd41e40bff2cbe01e42124d53f
2024-01-16 11:38:08 +01:00
Volker E 31ef381e90 build: Update 'svgo' to latest v3.2.0 and re-minify SVGs
The latest update of 'svgo' dependency includes three optimizations on
converting path commands, which
- improves closing paths and how we determine if to use absolute or
  relative commands.
- round arc or convert to lines based on the geometric sagitta
- convert cubic Bézier curves to quadratic Bézier curves where possible

Bug: T354875
Change-Id: Ibd611396c48ff6f971ee251b59f13e350e0f812f
2024-01-16 00:13:08 +01:00
James D. Forrester 2ef5278784 extension.json: Drop 'es6' flag, always true since MediaWiki 1.41
Change-Id: I6f8b1ce80138a98037ac245b2dc551c5e9167349
2024-01-12 19:04:39 -05:00
WMDE-Fisch a3f3cf9e3f build: Update eslint 0.26.0 and apply fixes
Mainly auto fixes but also getting rid of some straight forward lint
warnings to reduce the wall of issues a bit when running the tests.

Also removing some rule exceptions that seem to got more relaxed
upstream.

Change-Id: Icb4d73374583675be74517e6df6508314d61e8c2
2024-01-12 13:50:19 -05:00
James D. Forrester 863c442c32 .nvmrc: Update now we're using Node 18, and make CI pass
* Babel upgraded to a version that works with new Node's OpenSSL.
* Various loaders upgraded to match
* Babel config changed as plugin-proposal-private-property-in-object is now official
* Webpack config updated as noEmitOnErrors was renamed to not be a negation
* Webpack config updated as namedModules was renamed to the wider moduleIds
* Ignore the built Webpack output from eslint

Bug: T354943
Change-Id: I449f601b8218925d96bfb423fc0f349214d08385
2024-01-12 13:50:19 -05:00
jenkins-bot 93d9c88c26 Merge "Generalize settings code (attempt 2)" 2024-01-10 11:36:38 +00:00
Translation updater bot 9bde69f9bd Localisation updates from https://translatewiki.net.
Change-Id: Ibb5261f6dbbf03acb5a7b598e46a4a829d746d58
2024-01-10 08:33:17 +01:00
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
James D. Forrester e74d335904 .browerslistrc: Update reference to upstream
Change-Id: I4d0ef1cc0b543a9ba85d9972efcb9d6ee7aa5c67
2024-01-09 10:44:18 -05:00
Translation updater bot a529de8140 Localisation updates from https://translatewiki.net.
Change-Id: I9253cee6cfda89ba84f48bcc60da89c380d7c87e
2024-01-08 11:31:34 +01:00
Umherirrender f3c4642fd5 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Ib30da35841aadb558709dbbe6e30be2241048c87
2024-01-05 22:41:45 +01:00
Translation updater bot 4a2238e460 Localisation updates from https://translatewiki.net.
Change-Id: Ifd554386ba214135fc615803c23031da8f8ea2ab
2023-12-26 14:43:25 +01:00
Translation updater bot a6b7122003 Localisation updates from https://translatewiki.net.
Change-Id: I2dbf7774d25246a8c05eb72fc260c306b94033c3
2023-12-18 18:18:42 +01:00
Translation updater bot 2e6e6d778c Localisation updates from https://translatewiki.net.
Change-Id: I20868e08439bae7742dac06075a8e1d2f2394034
2023-12-11 10:43:46 +01:00
Translation updater bot 177f00bf2f Localisation updates from https://translatewiki.net.
Change-Id: I59b63195cc36ab89343a1b7bb2121971762c3d13
2023-12-07 10:02:56 +01:00
jenkins-bot 029992b971 Merge "Localisation updates from https://translatewiki.net." 2023-12-04 08:43:29 +00:00
Translation updater bot 4a93494046 Localisation updates from https://translatewiki.net.
Change-Id: I044247650db551310647940102d4e7b34176ee1b
2023-12-04 09:05:30 +01:00
Fomafix a333160955 Use namespaced ResourceLoader classes
The old class names are deprecated since 1.39.

Change-Id: I8a317a9fdb4ee0208e55e364e3e8c3817419d5b1
2023-12-03 19:56:28 +00:00
jenkins-bot cdfd8d2f37 Merge "Cleanup: Remove non-functional hook" 2023-12-01 17:06:11 +00:00
jenkins-bot cdede23c59 Merge "Update tests for PHPUnit 9.6" 2023-11-30 23:08:24 +00:00
Ed Sanders c0bf30fb58 Documentation fixes
* Element -> HTMLElement
* JQuery -> jQuery
* Remove `return {void}`

Change-Id: I887dfe98af77358ad4ef4e1c835ccf45c2c64400
2023-11-30 10:38:07 +00:00
Jon Robson 5abc2eed4c Cleanup: Remove non-functional hook
This doesn't work and Popups is not part of the
MediaWiki Language Extension Bundle

Change-Id: I66166ba964fba3a9ece865b701a95b66a924b9b6
2023-11-29 23:40:25 +00:00
jenkins-bot 6d642c38bd Merge "eslint: Enforce no-use-before-define" 2023-11-29 17:38:23 +00:00
jenkins-bot ea42009239 Merge "Update UserOptionsLookup's FQN" 2023-11-29 17:14:37 +00:00
Ed Sanders 2aadb01365 eslint: Enforce no-use-before-define
Only one issue to fix now that we don't error on functions.

Change-Id: Idaee60507557b2a73deaf03d93829b9dade5c1f0
2023-11-29 14:13:12 +00:00
gerritbot 96cea43fe1 Update UserOptionsManager's FQN
User-options related classes are being moved to
the MediaWiki\User\Options namespace in MediaWiki Core;
reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Icb39d3f73e120fd0d9dad5ae362787cd19d47bfb
2023-11-29 12:55:13 +00:00
gerritbot 031ace2dba Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: I0c66220b0ba9501e8ef20a172d21d7e75a19d6cc
2023-11-29 12:39:47 +00:00
Translation updater bot 65d5156e75 Localisation updates from https://translatewiki.net.
Change-Id: Ia0da83b099485cbf565a9ce1bf10715ac5af505a
2023-11-27 08:33:04 +01:00
Daimona Eaytoy d77b6e9992 Update tests for PHPUnit 9.6
- Avoid withConsecutive()

Bug: T342110
Change-Id: I3f07a2f071ddec3f9bbd147b8bfc0d32277203d6
2023-11-27 03:13:29 +01:00
WMDE-Fisch b218a77ca4 Remove all BetaFeature code from ReferencePreviews
The extension is out of beta and will be enabled by default now.
Leaving some hints if we decide to also remove the feature flag.

Bug: T282999
Bug: T351708
Change-Id: I1556b2f3592294d094770ede2c276eddeef8bbe9
2023-11-24 13:07:46 +01:00
thiemowmde 7596165a5d Fix confusing constant names in PHP
The …AFTER_BETA constant is the one we want to keep after we removed
all BetaFeature code. The naming scheme is just confusing.

Safe to rename. Not used anywhere else:
https://codesearch.wmcloud.org/search/?q=REFERENCE_PREVIEWS_PREFERENCE_NAME

We also decided to keep the $wgPopupsReferencePreviews feature flag.
Update the documentation accordingly.

This is split from I1556b2f to make it easier to review.

Bug: T351708
Change-Id: Ifbb41156f2a5a4d8a81e79f613754869c5c89690
2023-11-24 12:51:41 +01:00
Translation updater bot 0018e71804 Localisation updates from https://translatewiki.net.
Change-Id: Ia332c673e1362a1741db7fb5acc5e868a5b8c189
2023-11-22 08:20:29 +01:00
Translation updater bot b29fa65c83 Localisation updates from https://translatewiki.net.
Change-Id: Iaf76660a2e07eaa0bb824f4b4e0adf119f0f51d4
2023-11-21 08:29:42 +01:00
Translation updater bot d628a2a27f Localisation updates from https://translatewiki.net.
Change-Id: Ib8304901106e589f47afdac52e74e74dd2d8f85b
2023-11-20 08:52:04 +01:00
Translation updater bot 22b3e7e8e0 Localisation updates from https://translatewiki.net.
Change-Id: Ib273b5fadd4622974f98e42e10bb293573aca1f3
2023-11-16 09:09:51 +01:00
Translation updater bot 105288a0da Localisation updates from https://translatewiki.net.
Change-Id: Iebc9394150c97557d9e23c4741879fef22afc964
2023-11-15 15:44:01 +01:00
Translation updater bot 5f9430137b Localisation updates from https://translatewiki.net.
Change-Id: I8cf5a8e97109bcbba1dc3fb7c8ff1b01ada4e411
2023-11-13 08:42:07 +01:00
Jon Robson 31e416ba68 Allow disambiguation previews to render when no summary found
This allows preview types to override the default behaviour
which prohibits previews from rendering when the API finds no
extract. In the case of disambiguation pages the summary is not
required to render a preview.

Bug: T346686
Change-Id: Ifb8bbef943b02dfa971e2af96511ac708733bdd1
2023-11-09 13:02:51 -08:00
Ed Sanders bf3600f20a Convert nycrc from JSON to JS to allow comments
Change-Id: Ib3c3b8b2f5f87b5f00dcf8b718a0d1bf07948c56
2023-11-09 11:36:11 +00:00
Ed Sanders 461f949823 build: Update linters
Also restructure eslint config so that
* root files are linted with server rules
* src and tests share config

Change-Id: Ie4d0731ba9670af7f3e60cdfe3c4e331386b17c6
2023-11-09 11:36:08 +00:00
Translation updater bot 8cd688cb70 Localisation updates from https://translatewiki.net.
Change-Id: I3107389e206ae786a8e1abba9d6e030e51f37e3a
2023-11-06 08:57:18 +01:00
Jdlrobson 46d9c97180 Removing mw.ui.checkbox dependency (take 2)
This reverts commit af90386c67.

Reason for revert: The codex-styles module is now only loaded when
the settings cog is clicked.

Bug: T348069
Change-Id: I1d3c3a7b5c74c3e2d64765274468e48c014a4047
2023-10-27 16:46:40 -07:00
Jdlrobson af90386c67 Revert "Removing mw.ui.checkbox dependency"
This reverts commit 85d9a7b0ed.

Reason for revert: Unexpected visual change flagged by Pixel.
We're now loading BOTH codex search and Codex
styles on page load (the latter via JavaScript). This results in
a visual regression in the sidebar as the message box for
languages switches from MediaWiki UI to Codex. I am not 100% sure
what the right approach is here, but we should pause to assess
given this new learning.

Possible options
1) Add checkbox styles to codex-search bundle
2) Load codex-styles on page load instead of codex-search
3) Delay the loading of the codex-styles until the overlay is
rendering
4) Wait until Codex has code splitting.

Change-Id: I633364fea54b048492c6bde10b4c4cc8ab99b9ae
2023-10-27 21:59:46 +00:00
Jan Drewniak 85d9a7b0ed Removing mw.ui.checkbox dependency
wRemoves deprecated mw.ui.checkbox dependency
in favour of the `codex-styles` module.

Replaced checkbox markup in setting dialog accordingly.

Bug: T348069
Change-Id: I456a1c35cfc16703648c849917157258df67b224
2023-10-25 15:08:36 -04:00
Translation updater bot 8eb0e05dfc Localisation updates from https://translatewiki.net.
Change-Id: I03a362e7269ebd60c7fbfd1dbd356b63b13ce580
2023-10-24 09:38:25 +02:00
Translation updater bot 20cb4f5713 Localisation updates from https://translatewiki.net.
Change-Id: I739eeecc318d3fb3c85386cd160f337d0f5e8959
2023-10-20 09:20:30 +02:00
Jon Robson a6a65204c6 Revert "Generalize settings code"
This reverts commit 6924a89b07.

Reason for revert: Breaks persistence of setting
for anonymous users.

Change-Id: I3efc20f44281c1c68c4162584388e33bb38c4848
2023-10-19 14:13:15 -07:00