Commit graph

262 commits

Author SHA1 Message Date
jenkins-bot 5c75faed31 Merge "Move parseWikitextFragment up to ApiParsoidTrait" 2020-07-27 17:01:13 +00:00
jenkins-bot 9d6713bb2d Merge "Refactor postHTML in ApiParsoidTrait" 2020-07-27 16:59:31 +00:00
mainframe98 c5c7e173d0 Always add the mw-editsection-visualeditor class to veeditsection
Previously, when the editsection link of the section edit links had
a class defined (either by the skin or through an extension), the
mw-editsection-visualeditor class would not be added, as the + operator
on arrays does not merge existing entries.

The side effect of the mw-editsection-visualeditor class missing is
that the initialization code in ve.init.mw.DesktopArticleTarget.init
would add an additional link to the section edit links, resulting in
three links shown when VisualEditorUseSingleEditTab is false.

Change-Id: I4b25c63884fa367fb0e44c61323a19a71fb6b9d8
2020-07-26 20:44:38 +02:00
Ed Sanders eb98439453 Move parseWikitextFragment up to ApiParsoidTrait
Rename to 'transformWikitext' and rename 'postHTML' to match.

Change-Id: Icb1f519c7a3a88f36c51479333be8cfb5617dbe0
2020-07-22 14:44:11 +01:00
Ed Sanders 90bf7e0488 Refactor postHTML in ApiParsoidTrait
* Remove postHTML/postData separation, not very useful.
* Pass $oldid instead of full params object.
* Return full repsonse like other methods, instead of just body.

Change-Id: I0fe301475adeb0fd5952809c3f74f0cb19f89cfe
2020-07-22 14:44:11 +01:00
Ed Sanders 9089993417 API: Use ParamValidator constants
Also drop mustBePosted functions as the default implement
is already correct.

Change-Id: Ib8e0fe3f2638892df768438c9f47f90b4ca66968
2020-07-20 21:43:59 +01:00
C. Scott Ananian 4b04f413fa Zero-configuration VisualEditor + PHP for MediaWiki LTS
This copies the Parsoid extension code into includes/VEParsoid
to allow a "one extension, zero-configuration" install of
VisualEditor for MW's LTS release. The Parsoid code has been
re-namespaced (`VEParsoid` instead of `MWParsoid`) to avoid
autoloader conflicts if you actually install Parsoid as an
extension (as we do in Wikimedia production). Similarly, we
arrange that the ServiceWiring and RestRoutes configurations
are skipped unless running in zeroconf mode, to avoid
conflicts with the Parsoid extension.

This import matches Parsoid commit b30f223.

Bug: T248343
Change-Id: Ic63ce40f59c4be8f4fdc5f9ac17798353fc86866
2020-07-13 18:39:08 +00:00
Bartosz Dziewoński b819b8a657 getPreferredEditor() shouldn't return VisualEditor if it's disabled by the user
Bug: T257234
Change-Id: I68002cc7bf6935bad705497df6531e3611bd2ca6
2020-07-07 21:58:12 +02:00
jenkins-bot e358865765 Merge "Replace uses of Revision constants" 2020-07-03 04:18:58 +00:00
Ed Sanders 3ec5e04a37 NWE: Pre-populate editor when editing system messages
This is the same behaviour as EditPage.php

Bug: T256999
Change-Id: Id33161982742c16222ba5d58d2e800ab04dccca2
2020-07-03 04:21:18 +02:00
DannyS712 5fb5bc3060 Replace uses of Revision constants
Bug: T257010
Change-Id: I20c7737d0d00b3f47c2781c1c968db6a74a68ad3
2020-07-03 00:40:59 +00:00
Bartosz Dziewoński c73953a5f7 Fix switching to visual with changes in non-RESTBase mode
Bug: T253467
Change-Id: I02a524a539530f1907f276ef80b666dd446ae6b3
2020-06-29 16:23:02 +00:00
Ed Sanders 3dab0f8339 Follow-up I238632e: Allow etag to be null
Change-Id: I45fec02c3d3560ac10d179e59e75cb5f8210ba14
2020-06-26 17:03:31 +01:00
Ed Sanders afc22db25d ApiParsoidTrait: Add typehints
Suggests redundant checks that can be removed.

Change-Id: I238632e0a9af568f7c7a9897c43e4143dc9ebce8
2020-06-26 14:45:16 +02:00
Ed Sanders 703fbaa6a2 Factor out revision fetching and validation logic to ApiParsoidTrait
Change-Id: I7707b419afac2c11d7d0ca91a597ffc68e5e3fe4
2020-06-26 14:44:47 +02:00
jenkins-bot 645ce6e38f Merge "Hooks: Update to use DifferenceEngineViewHeader" 2020-06-24 18:08:03 +00:00
Lucas Werkmeister 3469f14036 Stop using WBC_VERSION
Ask the ExtensionRegistry if WikibaseClient is loaded instead.

Bug: T256238
Change-Id: Idff012822df3df5924e2dbf3876ca8c24c0bdca1
2020-06-24 16:53:37 +02:00
DannyS712 b69cf0217f Hooks: Update to use DifferenceEngineViewHeader
Bug: T255769
Change-Id: Ibd80adff646ef51814736716816a5574794dfb1a
2020-06-24 00:44:19 +00:00
jenkins-bot 20da05e8c3 Merge "api: Specify PARAM_TYPE => 'text' for multi-line text parameters" 2020-06-10 21:51:37 +00:00
Bartosz Dziewoński 1b86093b70 api: Specify PARAM_TYPE => 'text' for multi-line text parameters
This allows Special:ApiSandbox to display multi-line text boxes for
them, which makes testing the API easier.

Change-Id: I10541a8e9033d81740033da80d842f58d1d3e0de
2020-06-10 21:23:13 +02:00
jenkins-bot fd8265c8ac Merge "Make VisualEditorDisableForAnons only hide the tabs, not disable the editor" 2020-06-10 19:17:58 +00:00
Ed Sanders 41a5393965 VE BetaFeatures: Use unsupportedList
Bug: T254646
Depends-On: Ifc265ba90e290eabe74bd0ff84717010a003949f
Change-Id: I46a988b9cba66fd8a861be411cc29f72ccc25be0
2020-06-10 16:33:16 +01:00
Ed Sanders 9c8195f823 Replace browser blacklist/whitelist with (un)supportedList
Bug: T254646
Change-Id: Iac0fc850520f2a83954d3fac21b38715e2f76a8c
2020-06-10 16:30:57 +01:00
Bartosz Dziewoński f81f34f59d Make VisualEditorDisableForAnons only hide the tabs, not disable the editor
Bug: T253941
Change-Id: Id08514b3827c4315d69651bc2313bf8317ba12fc
2020-06-08 20:05:58 +02:00
Bartosz Dziewoński af719282b9 VisualEditorHooks: Use the enabledForUser() helper method more
Change-Id: I9ec8a88ea8f0545e16dc1488d52f43c8ce7a93fe
2020-06-08 20:03:58 +02:00
jenkins-bot a28a263192 Merge "Drop linting from the VE API" 2020-06-04 17:12:54 +00:00
Ed Sanders f01d4ab35d Drop linting from the VE API
Calling the linter is very slow as the result is not
cached. Extensions needing this (DiscussionTools) should
just call the Linter extension API directly.

Bug: T253799
Change-Id: I994b52ca70c29a32900741a36087f10144396720
2020-06-04 18:51:38 +02:00
jenkins-bot c65b311ecb Merge "Tweaks in API code per code review" 2020-06-03 10:40:14 +00:00
Umherirrender 742d91fe37 Parse messages in string context
The current default for Message::__toString() is to parse, so this
keeps that behaviour unchanged.

Change-Id: I528a60c1d9c0f8c1596a15e06a764200a2b2565f
2020-05-24 14:46:40 +02:00
jenkins-bot 8ac4b48e96 Merge "Use HttpRequestFactory::createMultiClient()" 2020-05-21 20:38:03 +00:00
Tim Starling 92ab300859 Use HttpRequestFactory::createMultiClient()
This allows it to respect the proposed limit on HTTP request timeout.

Bug: T245170
Depends-On: I8252f6c854b98059f4916d5460ea71cf4b580149
Change-Id: I1c3d96720709253ad15bb8528cdd132571de2e4e
2020-05-21 14:56:22 +10:00
jenkins-bot dc90695d8c Merge "Refactor getPreferredEditor and expose reusable parts" 2020-05-20 18:48:21 +00:00
Bartosz Dziewoński 63638e380d Tweaks in API code per code review
Follow-up to If5c8d95560cbb078ae4980f4a912cbaeafe53d3e.

Change-Id: Iff72b5b21c0f5ce6a45cc48d6a8fc060159d7d23
2020-05-19 19:56:56 +02:00
James D. Forrester 969b1f266b Replace use of old global with MW_VERSION constant
This repo already requires MW 1.35+ so compatibility isn't a concern.

Change-Id: I3be0e1afe7f9acb56e7070d9d81424b7461a1603
2020-05-15 12:09:26 -07:00
Bartosz Dziewoński 0528f806fa Extract Parsoid/RESTBase stuff out of our API code
Goals:
* Allow other extensions to reuse these methods (maybe upstream them
  to MediaWiki core later)
* Allow ApiVisualEditorEdit to extend ApiEditPage. We'll be able to
  reuse its definitions for API parameters instead of duplicating
  them, and we won't have to pass around unrecognized parameters.

Bug: T252573
Change-Id: If5c8d95560cbb078ae4980f4a912cbaeafe53d3e
2020-05-12 21:17:29 +02:00
Bartosz Dziewoński 91d40cdfc4 ApiVisualEditorEdit: Use existing action=compare parameters for PST
Change-Id: I436218871e0fae07b39b0c3aa75a0d00bc5fc6b2
2020-05-12 20:56:23 +02:00
Bartosz Dziewoński d92e600d58 Simplify API modules setup
We go through all this trouble to pass the config to the API modules,
and then we don't use it at all (we removed the uses recently in
ce094c72d and d85d30f9b).

If we end up needing the config there again, we can just get it by using
MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'visualeditor' )
anywhere we want, like we do all over the place in VisualEditorHooks.

Change-Id: I9d254a9946f0d24783baf68c409b10291a8fd1b3
2020-05-12 18:53:31 +02:00
Ed Sanders 50db102c4d Refactor getPreferredEditor and expose reusable parts
Separate out logic specific to edit pages

Change-Id: I5b3b47feeeca2085fcd283d55d7e9ceafa73be70
2020-05-07 14:33:21 +01:00
jenkins-bot 7643be1c98 Merge "Replace class_exists with ExtensionRegistry::isLoaded()" 2020-04-29 20:13:33 +00:00
jenkins-bot e4fe634201 Merge "ApiVisualEditor: Add option to return lint errors from Parsoid" 2020-04-24 10:03:40 +00:00
Bartosz Dziewoński ae86f7290b ApiVisualEditor: Add option to return lint errors from Parsoid
Depends-On: I6bbe2fc5aea07c65eb99768f2c44ed42601792a3
Depends-On: I6bdf5635763ef8a44d44a031c64cd7f289261a32
Change-Id: I723ec766d1244d117f8d624440026fe5af0d3403
2020-04-21 22:49:29 +02:00
James D. Forrester a4dee12d83 Replace class_exists with ExtensionRegistry::isLoaded()
Change-Id: I229f83cd18473bb3c89c376b0e2ec62d13feff37
2020-04-20 15:07:01 -07:00
Bartosz Dziewoński 1846b72998 Remove some hardcoded CAPTCHA support code
While we pretend that the ConfirmEdit CAPTCHA support is added by
ve.init.mw.CaptchaSaveErrorHandler in the ConfirmEdit extension,
we still have a bunch of code here required for it to work.

This commit removes some of it, no longer needed after
I6605017fd31a4f96c529dd0beb69e9f4433cebc1.

Depends-On: I6605017fd31a4f96c529dd0beb69e9f4433cebc1
Change-Id: I41e032fd754927b7ea6cfb767eb9f21b522ccacd
2020-04-15 13:18:47 +00:00
DannyS712 de392e6133 Remove use of Revision::newFromId
Bug: T246284
Change-Id: Ia3de1caeac5edb2a8ee272fb9b80d36e1d778314
2020-03-30 04:45:24 +00:00
Bartosz Dziewoński 73dcfb7122 ApiVisualEditorEdit: Fix handling of 'minor' parameter
The client-side code sends the empty string as the value of this
parameter when the edit should be marked as minor, and doesn't set it
at all when it shouldn't (this is the normal convention for boolean
parameters). However, the API code here was incorrectly handling the
empty string, and not marking the edit as minor as a result.

This was revealed by 50883dd7fe. Prior
to that change the original 'minor' parameter was forwarded to the
action=edit call if it was provided, overriding the 'notminor'
parameter, which was effectively added unconditionally.

Bug: T248257
Change-Id: I37fd73851d94906d79943692fb9136da03ea95fa
2020-03-23 17:36:34 +01:00
Bartosz Dziewoński 9e859a6145 ApiVisualEditorEdit: Remove unused output values 'basetimestamp', 'starttimestamp'
Our client-side code doesn't use them, and they should not be needed.

ApiVisualEditor still returns those, and they are needed there; this
method used to be shared by both classes until 25afae342a.

ApiVisualEditorEdit still has 'basetimestamp' and 'starttimestamp'
input parameters.

Change-Id: I7108468df2ff20f05bd141cb617e4e0f90c027ce
2020-03-17 21:04:51 +01:00
Bartosz Dziewoński 0039ca5bd3 ApiVisualEditorEdit: Remove unused variable $links
It was added in 78a52f1f80 (2014)
and apparently was never used?

Change-Id: I44a3305f805333f8ea3d35f4f937cc6210eb54eb
2020-03-17 20:38:53 +01:00
Bartosz Dziewoński 6d254de92e ApiVisualEditorEdit: Remove use of deprecated 'modulescripts'
It's unused and always empty, as of MediaWiki 1.33 (c6f34408).

Change-Id: I7997e8dcc5ce7221cf5586173dbb0fe62f9a7953
2020-03-17 20:31:45 +01:00
jenkins-bot 39a8ecf890 Merge "Remove X-Parsoid-Variant configuration value, which is no longer needed" 2020-03-17 00:13:39 +00:00
jenkins-bot c2975804a8 Merge "Don't pass through edit API params we've already handled" 2020-03-11 23:28:20 +00:00