Commit graph

245 commits

Author SHA1 Message Date
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
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
C. Scott Ananian ce094c72d4 Remove X-Parsoid-Variant configuration value, which is no longer needed
Reverts Ib1403638b12ec5808f6b81bd114949043aa9ac2e.

Bug: T229074
Change-Id: I9bbc02821d5ee82c9944516ab07d3cb380d2f3a8
2020-03-11 13:24:43 -04:00
jenkins-bot 248f1ea5e4 Merge "Pass a user when creating a new ParserOptions" 2020-03-04 08:12:02 +00:00
DannyS712 0dca373c62 Pass a user when creating a new ParserOptions
Bug: T246861
Change-Id: Idaed22f2b4c1a43be97b48a7718cb5a35a58edd1
2020-03-04 04:57:45 +00:00
Petr Pchelko 543d436d79 Remove usage of deprecated Revision::newRevisionFromTitle
Bug: T246284
Change-Id: I3ba2de7bda3bdc228cb4136d0190c43188b9b185
2020-03-03 20:16:43 -08:00
Ed Sanders 50883dd7fe Don't pass through edit API params we've already handled
This can lead to problems if the names in the VE API are
still used inthe Edit API, as previously happened with
`watch`/`watchlist`.

Explicitly list the parameters from VE API that were
previously getting passed to the Edit API automatically.

Change-Id: I8fe705b178af82d8285067909168d32cfb9a0421
2020-02-29 17:51:52 +00:00
Ed Sanders 42194ec411 Fix checkbox handling in the API
The code for setting 'watchlist' in the EditAPI request
was completely broken as it always evaluated to 'unwatch'.
Instead pass through 'watchlist' directly from the client
where it must be set to 'watch' or 'unwatch'.

Bug: T245579
Change-Id: Ia5a2bb76ef35a685b39bcc0c4727796acd0f510d
2020-02-29 17:35:29 +00:00
James D. Forrester eb02880f20 Hooks::isSupportedEditPage: Re-format to make the logic clearer
Change-Id: I8959f1bc4c632fb80fc02374d6ecfc94ef06d9fc
2020-02-12 15:39:55 -08:00
DannyS712 cb1b9b5f20 Remove use of Title::quickUserCan
Bug: T244927
Change-Id: I6d7fb8825d512d1bf9c0005289b28704412975c3
2020-02-12 06:49:52 +00:00
David Lynch 95f034ffc4 VisualEditorHooks: don't duplicate tag definitions
Also update the doc comment for our tags hook, as we removed one hook.

Change-Id: I431a707e97de9eb24416ef7972b5c59fd66ac35a
2020-02-07 01:22:23 -06:00
David Lynch 0d6f984cc5 Change tags method so anon edits will go through
It turns out anonymous users can't apply change tags, so change
I2c1d0f8d69bc03e5c1877c790247e165f160e966 broke editing for them.

Bug: T242184
Change-Id: I7c27e4d9995428e213a980819810f235fdfe9435
2020-02-06 15:31:45 -06:00
jenkins-bot 22c6449d5f Merge "Don't offer switching to VE if it's disabled in preferences" 2020-02-05 01:48:34 +00:00
jenkins-bot 124ae7a444 Merge "Tag VE edits from the client-side" 2020-02-04 16:43:59 +00:00
jenkins-bot 6cd05e686d Merge "Don't display duplicate protection notices when user can't edit" 2020-02-03 17:33:39 +00:00
Bartosz Dziewoński ba3f222e42 Don't display duplicate protection notices when user can't edit
In the core MediaWiki editor, the detailed messages about page
protection are only shown when the user is allowed to edit the page;
otherwise, a generic permission error is shown. Do the same here.

Change-Id: Ia0ca52b9bf556354218b2aa91f141b429b0c5880
2020-01-31 14:55:32 -08:00
David Lynch d85d30f9b3 Tag VE edits from the client-side
This opens up the API so that other tools can use it without being
forced to tag those edits as being from VE.

Also, document that tags is a working parameter that can be passed
through to the edit API.

Bug: T242184
Change-Id: I2c1d0f8d69bc03e5c1877c790247e165f160e966
2020-01-29 21:55:07 -08:00
Thalia cbf259a6ed ApiVisualEditor: Replace calls to deprecated Title methods
Replace Title::userCan with PermissionManager::userCan.

Replace Title::getUserPermissionsErrors with
PermissionManager::getPermissionErrors.

Change-Id: I1afec4ba62185c3cd555a10ae35cef01b7194221
2020-01-29 20:58:19 -08:00
jenkins-bot 4c8c0e0253 Merge "ApiVisualEditor: Refactor edit notice code" 2020-01-29 21:46:00 +00:00