Commit graph

1909 commits

Author SHA1 Message Date
Siddharth VP bded600e36 Avoid validating gadget definition content multiple times on save
The validation appears to be occurring 4 times:
1. JsonContentHandler->preSaveTransform --> GadgetDefinitionContent->isValid
2. GadgetHooks::onEditFilterMergedContent --> GadgetDefinitionContent->validate
3. ContentHandler->validateSave --> GadgetDefinitionContent->isValid
4. RevisionStore->checkContent ---> GadgetDefinitionContent->isValid

Caching the validation result reduces it down to 2.

(Validation in GadgetHooks::onEditFilterMergedContent is to provide a more useful error message than what ContentHandler gives – which is just "Invalid content data".)

Change-Id: I026751b7e9b111b4f0bb9ab5fa0e9737a0385b07
2022-01-26 15:39:14 +05:30
jenkins-bot 43a6221fc9 Merge "Localisation updates from https://translatewiki.net." 2022-01-13 07:29:08 +00:00
Translation updater bot 868591df51 Localisation updates from https://translatewiki.net.
Change-Id: Id0f8d7a3e6a3a578aed82a9a6162cbfd5770ec0f
2022-01-13 08:27:02 +01:00
jenkins-bot 22ad1b14fb Merge "Link entries on Gadget definition pages" 2022-01-13 07:25:37 +00:00
Kunal Mehta 44d3602898 Link entries on Gadget definition pages
Links the following entries in gadget definitions to the associated page:
- scripts
- styles
- datas
- peers
- dependencies (only when they are also a gadget)
- category (links to MW message page)
- messages

unserialize(serialize()) hack is a bit ugly, but it works.

Co-Authored-By: Siddharth VP <siddharthvp@gmail.com>
Bug: T298844
Change-Id: I9154f600997fe693410e7560ed30732102b806aa
2022-01-12 19:33:04 +05:30
Translation updater bot 2d1f320e23 Localisation updates from https://translatewiki.net.
Change-Id: Ib3ecee7f8352d60cb4165bd600efab42a3dc0d4f
2022-01-12 08:25:09 +01:00
Translation updater bot bf88b0826d Localisation updates from https://translatewiki.net.
Change-Id: Ib5cd5584bc8807360d3f8733e3c820202a8175f4
2022-01-11 08:23:08 +01:00
Translation updater bot 43fd45950e Localisation updates from https://translatewiki.net.
Change-Id: Ic809d9358186094d7d3dda1888313c47e247daea
2022-01-10 08:11:19 +01:00
Translation updater bot d51ddd3abc Localisation updates from https://translatewiki.net.
Change-Id: Id8a1473d5e75658012051bc779d9ac50ddc5aa18
2022-01-06 08:31:38 +01:00
Translation updater bot 2753d49ab3 Localisation updates from https://translatewiki.net.
Change-Id: Ib12b410d2c64863bf599895b7219c18d596ea893
2022-01-05 08:16:08 +01:00
Translation updater bot 5666eb11ba Localisation updates from https://translatewiki.net.
Change-Id: I4c461ffab1b0a3ee8b6a5f77d1c2309997665630
2022-01-04 08:27:49 +01:00
Translation updater bot 354c99e3d8 Localisation updates from https://translatewiki.net.
Change-Id: I5a9d21db2620a0a176f19f5c983a0c9a855de89a
2022-01-03 08:11:17 +01:00
Gergő Tisza 6b74e170c0
Add edit link to gadget definition in Special:Gadgets
When using the Gadget definition: namespace, link to the definition
pages from Special:Gadgets. Also change the wording of the links
to edit the names of the gadgets, to disambiguate them.

Change-Id: I327a4cfa9846edec60e1aaafc674cd66f4e0beae
2021-12-31 20:42:37 -08:00
jenkins-bot 2d86f9b62e Merge "Allow specifying page actions in definitions" 2021-12-31 19:35:18 +00:00
Siddharth VP 7ead5dab61 Allow specifying page actions in definitions
Allow specifying page actions ('view', 'edit', 'history', etc) in
gadget definitions. If specified, the gadget is run only on the given
page action(s).

This is especially useful for default gadgets like RefToolbar[1] and
TextReactions[2] that only need to be loaded while editing.

[1]: https://en.wikipedia.org/wiki/WP:RefToolbar
[2]: https://en.wikipedia.org/wiki/WP:Text_reactions

Bug: T204201
Bug: T63007
Change-Id: Idde71b3f1f6c36cd21539a2312be8f12217a9acc
2022-01-01 00:41:08 +05:30
Translation updater bot 4fd267d520 Localisation updates from https://translatewiki.net.
Change-Id: I1675022b99f576b0aeefb8c2c56d35126973bdec
2021-12-30 09:37:45 +01:00
Siddharth VP 1f7b9d90df Support JSON files in gadgets
The parsed content of JSON files in the gadget is made available from the
gadget's JS files via require(). That is, MediaWiki:Gadget-data.json (or
Gadget:data.json) is available as `require('./data.json')`. This is
supported for both MediaWikiGadgetsDefinitionRepo and
GadgetDefinitionNamespaceRepo. The JSON parsing is done server-side.

JSON can only be used in "package" gadgets - in which the JS files can
also be invoked via require().

Also added a test for GadgetResourceLoaderModule.

Bug: T198758
Depends-On: Ib4556d09c4d393269e32771aab00f59a5f630e1b
Depends-On: Id4589a597ccfc4266b3e63d10f75b146aa7a287a
Change-Id: I21acb46cdd244a39b5cc6963aa763f0113bd1e38
2021-12-27 17:33:21 +00:00
Translation updater bot 12e439a636 Localisation updates from https://translatewiki.net.
Change-Id: Ia152e9ae345a2a6995236c85a021a912fb10086a
2021-12-27 09:30:13 +01:00
Translation updater bot 4443e5a757 Localisation updates from https://translatewiki.net.
Change-Id: I276dba70b50c178d1de4da5ed3bd1d4ffbd5abd8
2021-12-23 08:38:05 +01:00
Translation updater bot 6239112b5c Localisation updates from https://translatewiki.net.
Change-Id: I710108eb957bf8321fa173707d982e7946acb7e9
2021-12-16 08:29:33 +01:00
jenkins-bot 0010b1802b Merge "Add global 'withgadget' query parameter for ad-hoc loading of gadgets" 2021-12-15 07:47:25 +00:00
Translation updater bot 9597ccb765 Localisation updates from https://translatewiki.net.
Change-Id: I743141f87b379825e33b1e84586b41d4f229505a
2021-12-10 09:19:27 +01:00
Translation updater bot 13924823de Localisation updates from https://translatewiki.net.
Change-Id: I6b160de284e2ed4d0e45dfbff88ab0baffc6afc2
2021-12-10 08:24:06 +01:00
Translation updater bot b4632bc4b9 Localisation updates from https://translatewiki.net.
Change-Id: If8c759188b56db82497d39767ad27fd89acd6e87
2021-11-29 08:11:45 +01:00
vladshapik b3524efe41 Avoid using User::getOption
Remove using of User:getOption since this method
will be hard-deprecated. Now it is soft-deprecated.

Bug: T296083
Change-Id: I140cbd5655ac4ae0ad7b6d30c5e6bae0008aba07
2021-11-26 12:27:39 +01:00
jenkins-bot 5614a885f4 Merge "Localisation updates from https://translatewiki.net." 2021-11-25 08:05:56 +00:00
Translation updater bot 5c68bc03e3 Localisation updates from https://translatewiki.net.
Change-Id: I93e9c6df7ff58d8dbab204ec2278b897eef83961
2021-11-25 09:02:09 +01:00
Translation updater bot 8478c86ae1 Localisation updates from https://translatewiki.net.
Change-Id: I086a93f1502e8905fa0e3946997ebcf85e68f1a7
2021-11-25 08:24:18 +01:00
Translation updater bot 8ca6563de3 Localisation updates from https://translatewiki.net.
Change-Id: I172d424d27196e4f0a6e476dc740f66c6ac31c74
2021-11-15 08:11:46 +01:00
jenkins-bot 905b4fb30c Merge "Re-apply "Make each gadget a separate preference, instead of one huge multiselect"" 2021-11-09 14:00:58 +00:00
Translation updater bot 05eb8cd98e Localisation updates from https://translatewiki.net.
Change-Id: I2ca0ef7f1a128a3c42ac1772d78e395355e8fc2c
2021-11-08 08:16:56 +01:00
Bartosz Dziewoński ea786ce9dc Re-apply "Make each gadget a separate preference, instead of one huge multiselect"
Previously attempted in 82281d82d0,
reverted in 7c4ac597e2.

This gives each section and each gadget's entry an `id` attribute,
which can be used for linking, as requested in T126962. Existing user
options still match the new preferences.

It also probably makes future improvements easier. No one understands
multiselects with subsections.

Bug: T126962
Change-Id: Ie96fd94c994d05ab8507920fa560c7ed9c1f9b69
2021-11-05 23:15:45 +01:00
jenkins-bot bd752b9442 Merge "Add namespace localisations for Hindi (hi)." 2021-11-03 07:59:10 +00:00
Translation updater bot 671290d263 Localisation updates from https://translatewiki.net.
Change-Id: Idd77538841e13109aa182076ef3e9829b6fd0dee
2021-11-01 09:33:47 +01:00
Siddharth VP 58ea7934d2 Add namespace localisations for Hindi (hi).
Change-Id: Id28a6ff5360dee806c3d9e665fbef2fd35575456
2021-11-01 10:36:47 +05:30
libraryupgrader aad009fd1f build: Updating mediawiki/mediawiki-codesniffer to 38.0.0
Change-Id: Id25bb6285fcde7e93ea3eeeffd0184ceaf7bc4ac
2021-10-24 04:01:25 +00:00
Translation updater bot 70123ae344 Localisation updates from https://translatewiki.net.
Change-Id: I4896736414ac9a239391ee36b11ed13e658b2862
2021-10-21 08:21:46 +02:00
Translation updater bot 6eb0ad00e6 Localisation updates from https://translatewiki.net.
Change-Id: Ib7d16cad3b4132c70c7abe96f84ec4c153fa96bc
2021-10-20 08:36:59 +02:00
Translation updater bot 397f7306c0 Localisation updates from https://translatewiki.net.
Change-Id: Ia2f94cbb98e036e3a86dc4f5803a2bc6f892c85c
2021-10-18 15:20:13 +02:00
Siddharth VP 14af941e88 Add global 'withgadget' query parameter for ad-hoc loading of gadgets
When viewing pages, the 'withgadget=' query parameter can be used in
the URL to load a gadget that isn't enabled by the user's preferences.

The gadget is only loaded if all other conditions are still satisfied
(supported skin, supported targets, required user rights).

Bug: T29766
Change-Id: I5b30d4e0010561685eef661a515e2892045bb776
2021-10-16 03:14:34 +00:00
Reedy 32677ff590 Various code cleanup
Change-Id: I59b7ac50b621df1da402752327841743141944e3
2021-10-09 01:34:45 +01:00
jenkins-bot 669b351241 Merge "Override ContentHandler::fillParserOutput instead of Content::fillParserOutput." 2021-10-08 14:32:36 +00:00
jenkins-bot 0a55c5f0f9 Merge "Revert "Make each gadget a separate preference, instead of one huge multiselect"" 2021-10-07 20:11:30 +00:00
Krinkle 7c4ac597e2 Revert "Make each gadget a separate preference, instead of one huge multiselect"
This reverts commit 82281d82d0.

Bug: T126962
Bug: T292777
Change-Id: I7c858b8c4bc12626ea1d53374ea4d75862f684ff
2021-10-07 19:52:18 +00:00
Roman Stolar cbad567396 Override ContentHandler::fillParserOutput instead of Content::fillParserOutput.
Prepare override for GadgetDefinitionContentHandler, remove usage in GadgetDefinitionContent.

Bug: T287158
Change-Id: Icc3fa02f7089eaccd2dad8ff28f3db8cbf8eac03
2021-10-07 13:09:05 +03:00
jenkins-bot 1d3af2d82b Merge "Add all gadgets to DefaultUserOptions" 2021-10-06 23:59:58 +00:00
libraryupgrader 4f825a72cf build: Updating ansi-regex to 5.0.1
* https://npmjs.com/advisories/5197 (CVE-2021-3807)

Additional changes:
* composer.json: Updated phpcs command in composer test (T280592).
* composer.json: Added phpcs command to scripts (T280592).

Change-Id: I6d2a147836bc717b4c70211a9ea6b9d0365a1936
2021-10-04 22:12:57 +00:00
Bartosz Dziewoński 82281d82d0 Make each gadget a separate preference, instead of one huge multiselect
This gives each section and each gadget's entry an `id` attribute,
which can be used for linking, as requested in T126962. Existing user
options still match the new preferences.

It also probably makes future improvements easier. No one understands
multiselects with subsections.

Bug: T126962
Change-Id: Ifaca96e288c475017636c2408712d6a20aa77da9
2021-09-30 18:39:41 +02:00
Umherirrender d175e964db Add all gadgets to DefaultUserOptions
Without the default the preference is never deleted from the database,
even it was disabled by the user.

Bug: T291748
Change-Id: I1010e260fda118cbea83ad39e33055e403e37630
2021-09-29 08:19:16 +00:00
Translation updater bot 0007744ee6 Localisation updates from https://translatewiki.net.
Change-Id: I20f9b00d5deee7bb27599b7af7eac68600e5e03f
2021-09-28 08:18:48 +02:00