Commit graph

94 commits

Author SHA1 Message Date
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
jenkins-bot 124ae7a444 Merge "Tag VE edits from the client-side" 2020-02-04 16:43:59 +00: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
libraryupgrader 1baeb9ef0c build: Updating composer dependencies
* mediawiki/minus-x: 0.3.2 → 1.0.0
* mediawiki/mediawiki-phan-config: 0.9.0 → 0.9.1

Change-Id: Ibf55f382c586603967da0086f86bfe4924e7cf96
2020-01-26 18:27:39 +00:00
James D. Forrester 2c77e88d2c doc: Bump copyright year for 2020
Change-Id: I30539877543dc2a57bd1428a00d10ac46d8fc294
2020-01-08 09:13:24 -08:00
jenkins-bot 3e3a84f9b6 Merge "Fix 2017WTE change tag for edits that blank the page" 2020-01-06 18:30:29 +00:00
Bartosz Dziewoński 54f2ba68d7 Fix 2017WTE change tag for edits that blank the page
Bug: T241797
Change-Id: I5c843f7ebcffba720f3dd0564947c197a76cf82e
2020-01-03 08:49:44 +01:00
Ed Sanders 21b676452e Fix Special: title in ApiVisualEditorEdit
We also do this in ApiVisualEditor.

Change-Id: I5c27c6e7770d0a5093684cadeaf1786f85dc32ff
2019-12-20 15:50:48 +00:00
libraryupgrader c8de97fcd2 build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: Iaaea284190aa9306177b3ee945a75da631a89b93
2019-12-16 10:11:47 +00:00
jenkins-bot af700cd536 Merge "ApiVisualEditorEdit: Normalize newlines in wikitext" 2019-12-13 15:42:50 +00:00
Bartosz Dziewoński 9779336403 ApiVisualEditorEdit: Simplify diff handling a bit more!
Dealing with `result: 'nochanges'` is annoying. Just return an empty
diff to indicate no changes.

Change-Id: I192caa67ec85224500a6919efd370cf7b5c1c592
2019-11-24 09:51:54 +00:00
Bartosz Dziewoński 1e890f975f ApiVisualEditorEdit: Simplify diff handling a bit
I'm trying to track down possible values of 'result' for client-side
error handling and this was confusing.

Change-Id: I325249f7c57936c9c11a1d3dc9166b1ca3737c39
2019-11-18 15:57:36 -05:00
Bartosz Dziewoński a4d7c41e68 ApiVisualEditorEdit: Normalize newlines in wikitext
Firefox apparently sends us \r\n newlines, even though we use \n.

Bug: T154977
Change-Id: I22e9a2e11c63ab62b6e37c86455638bf23d5b431
2019-11-13 23:24:06 +01:00
Ed Sanders 1bb72f0bb5 Replace deprecated easy-deflate.deflate with mediawiki.deflate
Change-Id: I5c77d4818074fd3dc937d7688d449952b92ee358
2019-10-30 19:13:47 +00:00
Bartosz Dziewoński cbd500a9ee Don't log missing ETags when creating a new page, that's normal
Same idea as f3dfd98e55. Oops.

Bug: T233320
Change-Id: Id31bd4806da5489a4438d385553a22d33676fc3a
2019-10-23 22:15:03 +02:00
Bartosz Dziewoński f7ee7dc807 Try using structured logging again
The configuration of Wikimedia wikis should be fixed.

This reverts commit 04407e9eb1
and also makes similar changes to new logging code added in
5d1a67757a.

Bug: T234564
Change-Id: Ic999b050e68b71f5a1737366e16f133e5a557307
2019-10-21 17:04:23 +02:00
James D. Forrester dec54cf56e build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: I23702d16eee09292b63051f94103a3bca3b1dd13
2019-10-11 12:42:23 -07:00
Bartosz Dziewoński 04407e9eb1 Don't try to use structured data in structured logging, it doesn't work
Our log messages were being silently dropped. Experimentation revealed
that our structured logging system doesn't actually like it when we
try to log structured data.

See: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/540464/3/includes/ApiVisualEditorEdit.php

Put it all in the message strings, whatever.

Change-Id: Iae778f95774df2e24b30387221e39e097e25a4cf
2019-10-02 23:13:40 +02:00
Bartosz Dziewoński df0c8ad02d ApiVisualEditorEdit: Add logging for funny etags
Bug: T233320
Change-Id: I0f321df057068e1dd396a04a9e194853c2b0e9e4
2019-10-02 03:23:29 +02:00
Bartosz Dziewoński 7c2e61d502 ApiVisualEditorEdit: Remove special handling for SpamBlacklist
No longer needed after Id36aa6bdb8f873fe7deb8123a7fc774103721c01,
which teaches SpamBlacklist to return its own error messages.

Depends-On: Id36aa6bdb8f873fe7deb8123a7fc774103721c01
Bug: T211443
Change-Id: I462c2002f9b596cbdfd7ce3673d4e362e5bd1aaf
2019-09-11 21:55:25 +00:00
DannyS712 00a98dd8f2 Fix 'paramter' typo in code and add to typos list, now covering PHP
Bug: T201491
Change-Id: I28d3b3871a2de54e575163bec7c364b68da8d5a6
2019-08-20 12:10:04 +01:00
Ed Sanders 3a4822c2fe Section switch from wikitext to VE
Use an API 'parse' call with a sectionid to trigger
a full document expansion using replaceSectionAtRev.

Then send this off the RESTBase to convert to HTML
and statsh.

Ensure the etag is passed back to the API response.

Bug: T117716
Bug: T223023
Change-Id: I1b35b28e428a1f86d2e34d90ddbe73361ce14818
2019-05-13 19:49:10 +01:00
Aaron Schulz e2fa08f0f8 Use PageEditStash services instead of static methods
Change-Id: I1bcda750a22dcacfffa0f7400411a7653806a82e
2019-04-23 12:45:21 -07:00
Aaron Schulz 1a5fc05dda Avoid keeping excess keys from storeInSerializationCache() in cache
Remove overkill $VisualEditorSerializationCacheTimeout config setting
and just use a simple constant instead (convention over configuration).

Bug: T203786
Change-Id: I94424088a03a3262fcea30132883a612465c546e
2019-04-03 18:34:07 +00:00
Aaron Schulz a56fbba6c3 Clean up serialization cache code a bit and add more metrics
Change-Id: Ib2024026a2b6f42ed0c56479a0cec2a8cbd1e3bc
2019-03-28 00:26:37 +00:00
Umherirrender de8b4b5d29 Use php null coalesce operator ??
Change-Id: I756fa99084cbb86357ac840b3338d296863eecc4
2019-03-12 21:27:47 +01:00
jenkins-bot f501a5238b Merge "Fix return type of ApiVisualEditorEdit::saveWikitext" 2019-03-08 20:50:04 +00:00
jenkins-bot 476ffbba68 Merge "Use DerivativeContext in ApiVisualEditorEdit" 2019-03-04 19:09:19 +00:00
Umherirrender c9a3bf9fa5 Use DerivativeContext in ApiVisualEditorEdit
Using DerivativeContext also makes the code easier to read.
getContext() returns an IContextSource, in this interface has no
setRequest() method and this can fail for some kinds of IContextSource.
$view is a ContextSource, which implements setContext().
This also allows us pass in a new context with the right request object,
and also to set the title so we don't have different titles
on $view and the main context.

Change-Id: Ia575cd6163defeb423a542e342034cac5eb6108c
2019-03-04 18:36:47 +00:00
Umherirrender a07ad01594 Use ::class for class name resolution
Available since php5.5

Change-Id: I9392155193275d20a82bde8eb7964d466e190f6b
2019-03-02 23:46:12 +01:00
Umherirrender 8c1eda388e Fix return type of ApiVisualEditorEdit::saveWikitext
Change-Id: I523d8097b39d80fc7082c64009b49b36f8a296a7
2019-03-02 18:04:14 +00:00
Umherirrender 57d00b7197 Improve param docs
Change-Id: Ib8e22c6029cb11635d6fe9cce17775f67a2a589a
2019-01-26 14:50:22 +01:00
James D. Forrester 3c293ea00c doc: Bump copyright year for 2019
Change-Id: I8991b97c980d4149f53eb5601036220ef3c0c440
2019-01-01 13:24:23 +00:00
Bartosz Dziewoński c9ddb8b204 ApiVisualEditorEdit: Add a comment to a tiny but important line
Code added in 393807462e.

Change-Id: I0393a68939c8b103f09d4b25585637faeb76090d
2018-11-26 23:11:29 +01:00
Kunal Mehta 8ca03768a1 API: Check whether content is deflated before trying to inflate it
Bug: T201083
Change-Id: I5cad1848b19460ba86043d4627413f939b6d3a5f
2018-08-02 12:38:55 -07:00
Ed Sanders a6ea005f15 Remove EasyDeflate libs, upstreamed to core
Change-Id: I70ac6669038238b91eba8484792b75b09e7355d4
Depends-On: I12a5879188f46f17dc4c33bdad52317d218d4172
Depends-On: I0fa382c2828ff2644ed308dc1ccca85735d0a80d
2018-07-26 18:18:52 +00:00
Jack Phoenix d9066c829c Replace wfMemcKey with $wgMemc->makeKey
Change-Id: I959edd0816917bc49deb40d6990517afdcbeae15
2018-07-02 14:43:06 +00:00
Ed Sanders bb1d7271cd Pass content language in Accept-Language header to RESTBase
Bug: T198186
Change-Id: I2176f68f76fa462de0c1c2c47365de62fda4abe0
2018-06-26 16:42:35 +01:00
Ed Sanders 1b116394cf Correct documentation of $title Title object and add type hints
Change-Id: I8108161e2330d54e9e3f9969ead9352cc5810fb0
2018-06-26 16:35:46 +01:00
James D. Forrester 31f667ccf7 doc: Document all public and protected PHP functions
Also move the maintenane script to a name that makes
MediaWiki.Files.ClassMatchesFilename.NotMatch not error,
and use the more restrictive licence tag usage for
MediaWiki.Commenting.LicenseComment.InvalidLicenseTag.

Change-Id: Ifa5518cd590ae83c6fd76f1dbb5a2ce40de4b119
2018-03-28 12:50:44 -07:00
Aryeh Gregor 6ebb3dad65 Required API parameters cannot have defaults
It doesn't make sense to have a default action here, per Esanders.

Blocks I4a2505cfc8e86e73e46d40acffbf3cd8803458e2.

Change-Id: I02259a5117f3539593ccd09cfd4c8271e8464388
2018-03-28 16:49:19 +03:00
Ed Sanders 2b033f6ee0 Use action=compare for wikitext diffs
Diffing in action=query is deprecated since 1.30.

Bug: T189397
Change-Id: Ic1fecd4517a1410e3c8e3593a031ad7b8ffb57d4
2018-03-10 22:32:02 +00:00
Jayprakash12345 936dbda876 Update at-ease calls in extensions
Bug: T187037
Change-Id: Ifbba289cc78eb005fa974cdb941b17335974ec78
2018-02-12 19:20:59 +00:00
James D. Forrester fa9438e5fa build: Move PHP files to expected paths
Principal code is in includes/*.php with the file named the same as the class it
contains. The maintenance script is moved to maintenance/ for clarity.

Change-Id: Icb4cdffb1bd4716e14f883d667def96671b42992
2018-02-07 12:31:08 -08:00
Renamed from ApiVisualEditorEdit.php (Browse further)