Commit graph

1938 commits

Author SHA1 Message Date
Translation updater bot 035dea565d Localisation updates from https://translatewiki.net.
Change-Id: I3074d21f21ee2b047c5ec35b7dadd87f1b9ab403
2022-02-22 08:11:42 +01:00
Translation updater bot 17e2369774 Localisation updates from https://translatewiki.net.
Change-Id: Idaed0c0e108be9c9e117dc311e0977baeac74f26
2022-02-14 08:14:21 +01:00
Translation updater bot 42b985460e Localisation updates from https://translatewiki.net.
Change-Id: I27c303e502f2936b9ff785d205328af25a269888
2022-02-11 08:41:36 +01:00
Translation updater bot e489ab6982 Localisation updates from https://translatewiki.net.
Change-Id: I072b658c34180b5e2e6527ab8335391b4ced0f7f
2022-02-08 08:28:36 +01:00
Translation updater bot 65ffc6946a Localisation updates from https://translatewiki.net.
Change-Id: I93aba9c3bdd949d17d572502742115fc75deeff7
2022-02-07 08:22:07 +01:00
Translation updater bot dfe7928f4e Localisation updates from https://translatewiki.net.
Change-Id: I0149053b723ab0f9c2afa4e9f5c8719e36a81525
2022-02-03 08:44:06 +01:00
Translation updater bot 20e2ed0016 Localisation updates from https://translatewiki.net.
Change-Id: I5158740203cf4e0f65ab9fbd2d3839991de1c213
2022-02-02 08:20:03 +01:00
Translation updater bot 32cbc20b8c Localisation updates from https://translatewiki.net.
Change-Id: I56a2e3e9e1baadc12cfed58c55cc504c00bf0f32
2022-02-01 08:27:01 +01:00
Translation updater bot 6a847a1bf1 Localisation updates from https://translatewiki.net.
Change-Id: Ic6e79aac0ef2d4121b833cad5dd3d1b44149049d
2022-01-31 08:22:04 +01:00
Translation updater bot f86502f292 Localisation updates from https://translatewiki.net.
Change-Id: I587f0ed6b35b2be6d80bcd70684e0ba62729c92d
2022-01-27 08:38:46 +01:00
jenkins-bot f238e6d4e1 Merge "Avoid validating gadget definition content multiple times on save" 2022-01-26 18:24:44 +00:00
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
Translation updater bot 0f0688ebf2 Localisation updates from https://translatewiki.net.
Change-Id: I2468ba1d2c3b606ab0e131fb4284ef12d3d65b1c
2022-01-26 08:25:02 +01:00
Translation updater bot 36a19b1613 Localisation updates from https://translatewiki.net.
Change-Id: I301170495b9898ce04cccac45f67e80ff49fcaa9
2022-01-25 08:32:41 +01:00
Translation updater bot 0a7aeb655a Localisation updates from https://translatewiki.net.
Change-Id: Ife73c783a439fa4d01f2dd11821b4804922a78eb
2022-01-24 08:27:14 +01:00
jenkins-bot de2ed9219f Merge "Restrict ?withgadget query parameter to opt-in gadgets." 2022-01-24 00:46:10 +00:00
Ammarpad 5d3a547c8b Restrict ?withgadget query parameter to opt-in gadgets.
?withgadget query parameters allows for ad-hoc loading of gadgets
(after passing all other basic checks). This was recently added in
I5b30d4e.

In T29766#7611796 Gergo raised concerns about how this can be
potentially abused.

This patch aims to restrict the feature by giving gadgets latitude
to either use it or not depending on the nature of the gadget.

The patch does so by adding `supportsUrlLoad` option that gadgets
(maybe those deemed safe) can use it to opt-in to the parameter.
By default gadgets don't support it, so it can be enabled for each
on a case-by-case basis.

Bug: T29766
Change-Id: Ie64174085e650579d76cc862774a4fe1b3d08396
2022-01-24 00:31:19 +00:00
C. Scott Ananian 165a030a4c Passing a string to ParserOutput::addModules()/addModuleStyles() is deprecated
In addition, renamed several instance of $output to $parserOutput to
help readers (and code search!) differentiate between variables which
contain a ParserOutput and those which contain an OutputPage (esp.
since those two classes contain many similarly-named methods).

Bug: T296123
Change-Id: If34330acf97d2c4e357b693b086264a718738fb1
2022-01-20 13:12:33 -05:00
Translation updater bot 55f4ba11a7 Localisation updates from https://translatewiki.net.
Change-Id: I69b7d2ad03d25b7cdae1242411d9d380768e818b
2022-01-20 09:17:40 +01:00
jenkins-bot 6fb18ae1fb Merge "Tighten some type hints" 2022-01-20 02:03:10 +00:00
Bartosz Dziewoński 4e27ab0e01 Tighten some type hints
* Gadget::isEnabled() only requires a UserIdentity, not the whole User
* Gadget::isAllowed() only requires an Authority, not the whole User

Both of those interfaces are implemented by the User class, so this is
compatible with all existing code, and it's easier to call from code
that only has access to a UserIdentity/Authority.

Change-Id: I8ea710c555f6fb7790ae575bb60aab1a05e288d8
2022-01-19 23:30:40 +00:00
Translation updater bot 8ad07cc7a1 Localisation updates from https://translatewiki.net.
Change-Id: I9c62de9f416a452410880815e37f04009ec90095
2022-01-19 08:24:06 +01:00
jenkins-bot 1cd6771f3a Merge "Avoid raising exception while trying to change content model of gadget definition" 2022-01-18 21:18:22 +00:00
Translation updater bot cce06923c6 Localisation updates from https://translatewiki.net.
Change-Id: I0f952e9e3de8c417cf7062daf0007410a385df80
2022-01-18 08:10:54 +01:00
jenkins-bot 0d32a53c3d Merge "Add Burmese special page and namespace aliases" 2022-01-17 08:13:12 +00:00
Translation updater bot bb07f9305f Localisation updates from https://translatewiki.net.
Change-Id: I688f67eb0838162b8cf9c0f3c9e264a47e7423bf
2022-01-17 08:12:10 +01:00
jenkins-bot d883cfefe4 Merge "Avoid adding hidden gadgets in default options" 2022-01-17 05:39:56 +00:00
Siddharth VP f1673c441a Avoid raising exception while trying to change content model of gadget definition
Currently, trying to change content model of a page in gadget definition namespace (via either the special page or the API) raises an exception. This uncaught exception has been replaced with a localisable error message.

Bug: T299303
Change-Id: Iad7d353d03cdfb52bf66aa2c9a12bc71a840577c
2022-01-16 22:43:37 +05:30
Siddharth VP 43efda4f96 Avoid adding hidden gadgets in default options
Hidden gadgets do not have associated user preferences. Adding them to $defaultOptions only causes them to be unnecessarily exported in mw.user.options.

Bug: T299071
Change-Id: Ic55e7f2a9daa405cddd0189de3d32f5825bc336a
2022-01-14 09:23:30 +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