Commit graph

20663 commits

Author SHA1 Message Date
Bartosz Dziewoński fcc6decd57 ApiParsoidTrait: Fix MediaWiki\Rest\HttpException handling
Don't use RawMessage, the API error formatter doesn't know what to do
with it. Instead call dieWithException(). These exceptions probably
shouldn't bubble up here, but we can worry about that later.

Bug: T344173
Change-Id: I3d1645a3580feeed6fe1431a7bfcdc584f681061
2023-08-16 15:11:28 +00:00
Bartosz Dziewoński ca64e7e407 ApiParsoidTrait/DirectParsoidClient: Simplify error handling
After catching the REST exception, just throw an API exception.
Remove the step inbetween where we built a response array.

Bonus:
* Remove tests that only tested this array building.
* Remove the unused 'code' from successful responses, and update
  documentation of return value shapes.
* Remove impossible check for `$ex instanceof LocalizedException`.
  After moving the code into one place, it's obvious that it can't
  happen, since LocalizedException doesn't inherit from HttpException.

Bug: T341613
Change-Id: I31370efeed9d5283b53eafca102b2f1efc811d27
2023-08-16 17:09:18 +02:00
David Lynch 228596cba0 Add a Process to the save workflow
A new hook `ve.preSaveProcess` is triggered to give other code the
chance to add steps to the process. The save dialog won't show until
the process completes. A step can be failed to return to normal
editing.

Change-Id: Id0740ff58ba9d9519c81174100ef1b8f8740870b
2023-08-16 15:59:04 +01:00
Ed Sanders 4c69113ed8 Edit check: Reduce scope of try block
Change-Id: Ife185999d3a0e084720a7aac4d360d65db08a131
2023-08-16 15:58:27 +01:00
Ed Sanders 3d92231cd1 Edit check: Guard against completeHistory being empty
When the document store has no entries (e.g. an empty page)
we don't initialise completeHistory with a retain transaction.

Bug: T333710
Change-Id: I5cc4ab3ea5f63a7eab804831df62d5c7ce2447e9
2023-08-16 15:57:54 +01:00
jenkins-bot 9070d1e98b Merge "Catch errors in addPlugin callbacks so VE load isn't broken" 2023-08-16 14:29:12 +00:00
Translation updater bot aee14ea44e Localisation updates from https://translatewiki.net.
Change-Id: I7a51052f5d3c2b04aa680ee73bd8dbd0b5c4ccee
2023-08-16 09:12:46 +02:00
Umherirrender 08b33b2a7d Use HookHandlers for BetaFeatures hook
Bug: T271034
Change-Id: I74ca4a6645c05795c83df5474314d3d1dc556eb0
2023-08-16 05:23:38 +00:00
jenkins-bot 9690fcfee6 Merge "ApiParsoidTrait: Remove unused 'x-cache' header handling" 2023-08-15 19:37:53 +00:00
David Lynch 745d13ae4b Catch errors in addPlugin callbacks so VE load isn't broken
Change-Id: I8a1eb058f10e356b3af5588862633b78f0b0ff92
2023-08-15 13:49:16 -05:00
Umherirrender 9b4c433cd8 Merge SkinTemplateNavigation::Universal hook handlers
- The code in the hook handler is more related to the hook and the
  structure of the $links array as to the special page.
- Loading another class to process the hook is not necessary.
- Allows better migration to new hook handlers (special page classes and
  hook handler should be separated).
- Replace SpecialCollabPad::getSubPage with
  SpecialPageFactory::resolveAlias.
- The local url to Special:CollabPad is now in the content language
  (only relevant for non-english wikis).

Change-Id: I82985a8ba129b4e336cee337af31452e804090b3
2023-08-15 20:39:10 +02:00
jenkins-bot 4f30b22c33 Merge "ArticleTarget: Remove misleading error message on 'badtoken' errors" 2023-08-15 09:27:19 +00:00
jenkins-bot 7cbc464353 Merge "ArticleTarget: Remove unused retrying support" 2023-08-15 09:26:40 +00:00
jenkins-bot 4470c6ae71 Merge "ArticleTarget: Remove duplicate error codes when logging" 2023-08-15 09:25:51 +00:00
Translation updater bot 1718ab479c Localisation updates from https://translatewiki.net.
Change-Id: I742e6f1cd81064184ac648c80e28641a23dcd1c1
2023-08-15 08:27:03 +02:00
Bartosz Dziewoński 9dd85ee26f Update messages when becoming logged-in/logged-out for IP masking
See T343848 for discussion about the phrasing.

Bug: T343848
Change-Id: I15628492fd2ff7ba93f91d3eeefa4b65ca313ca5
2023-08-14 23:37:04 +02:00
Ed Sanders 241d3da05d Remove extra margins from visual diff in Minerva
Bug: T344181
Change-Id: I5a2a9413ee5125ca7dc416ce3e8b75060dc96b83
2023-08-14 19:13:50 +01:00
Bartosz Dziewoński 870841b407 ArticleTarget: Remove misleading error message on 'badtoken' errors
This method was only called, and the message was only shown, when
retrying after the first 'badtoken' error and refreshing the token
fails again.

If this happens, it usually indicates some terrible problem with
the wiki, and it is not something that can be fixed by logging in
again (or anything else the user can do).

Let the default API error message appear ("Invalid CSRF token.").
While not very helpful to the user, it should be more helpful to
the site administrator trying to unbreak their wiki.

Remove the "visualeditor-savedialog-identify-trylogin" message.
Keep "visualeditor-savedialog-error-badtoken", which is re-used
in another error message. I'll fix that separately.

Change-Id: Ib680218bce5ae38aa52d7d941218a6410ab7e09e
2023-08-14 19:58:26 +02:00
Bartosz Dziewoński 4bb8d8f8ea ArticleTarget: Remove unused retrying support
This has not been used for many, many years, since we started using
mw.Api#postWithToken, which automatically retries on 'badtoken' errors.
Most of our code for it was removed (e.g. save() is never called
with three parameters), but some comments and parameters remained.

Change-Id: Ibca2a222f808e6e2796ed6a61e9587a646afcf31
2023-08-14 19:58:26 +02:00
Bartosz Dziewoński 46f661ac66 ArticleTarget: Remove duplicate error codes when logging
Occasionally we end up logging error codes like
"abusefilter-disallowed,abusefilter-disallowed,abusefilter-warning"
when someone hits a bunch of different filtes.

Change-Id: I967d374d13473ca684412b380d732653a3ceaff3
2023-08-14 19:58:26 +02:00
Bartosz Dziewoński 01b3137afa ApiParsoidTrait: Remove unused 'x-cache' header handling
After we removed other clients, the $response array can only be
generated by DirectParsoidClient::fakeRESTbaseHTMLResponse(),
which never includes a fake 'x-cache' header in the response.

Bug: T341613
Change-Id: I90bcb1e26e4164f8f4a34da3abcb01ac0769e21a
2023-08-14 16:54:53 +02:00
Translation updater bot 09f3c43759 Localisation updates from https://translatewiki.net.
Change-Id: I83b5bde131a07055f4e775f9c6cf97f4c7181ea7
2023-08-14 09:18:53 +02:00
jenkins-bot 4b1503e3cd Merge "Convert WikitextPasteContextItem to PersistentContextItem" 2023-08-14 05:08:05 +00:00
jenkins-bot 704e7ab295 Merge "Port Parsoid's WTUtils::textContentFromCaption" 2023-08-11 22:02:10 +00:00
jenkins-bot 023fe1af0a Merge "Use passive event listeners for window scroll events" 2023-08-11 21:30:14 +00:00
Ed Sanders 916b7beb22 Convert WikitextPasteContextItem to PersistentContextItem
Depends-On: Id2900c2d2c692b611e611b7eee6cacb74a737a8c
Change-Id: Ic539a41e8623c4ed12e4fa0e24db826ca967ee5a
2023-08-11 12:54:38 +01:00
Translation updater bot 8e1c84c0a7 Localisation updates from https://translatewiki.net.
Change-Id: I53066eb145f551cf50b7e485d027cfc788de73fb
2023-08-11 09:02:13 +02:00
Arlo Breault 674095bbaf Port Parsoid's WTUtils::textContentFromCaption
Matches the changes in Ice62d61d1a4f661770869b43d54eb8fc20824b71

Bug: T339237
Change-Id: I16301750ae8693e850aa3ce83bbb477f820d5cae
2023-08-10 18:06:27 -04:00
Ed Sanders c9ab1d148e Update VE core submodule to master (d90ae3a9c)
New changes:
88fe7eef7 Localisation updates from https://translatewiki.net.
54d9ce473 Localisation updates from https://translatewiki.net.
ddb809ba1 Implement PersistentContextItems
7fd68cde3 Add a "review mode" to the surface view
850d0655c Localisation updates from https://translatewiki.net.
d90ae3a9c Localisation updates from https://translatewiki.net.

Change-Id: I4439a413045125972d9756a5a6f149d7abf82f82
2023-08-10 13:59:51 -04:00
Translation updater bot 653ca76afe Localisation updates from https://translatewiki.net.
Change-Id: Ica378aef150f83a9a95e714cba7be09fdc788e7a
2023-08-10 09:42:28 +02:00
Ed Sanders a54f36c886 Use passive event listeners for window scroll events
TODO comments suggested using the VE helper util, but
that is no longer necessary since all our browsers
support passive events.

Change-Id: Idb7e702d58931208d555a3f994cd0b73abec2e20
2023-08-09 16:42:23 +01:00
Translation updater bot 8db407d33a Localisation updates from https://translatewiki.net.
Change-Id: I83ec5340d6a079a98dcf6adcd11004a0a3915ec5
2023-08-09 09:16:02 +02:00
jenkins-bot 8be133fe66 Merge "Reduce code duplication in ve.ui.MWGalleryDialog" 2023-08-08 18:55:30 +00:00
Translation updater bot d780084260 Localisation updates from https://translatewiki.net.
Change-Id: I08f845e049c45c5ee1a2bc408c83a6af96b6b140
2023-08-08 09:01:55 +02:00
jenkins-bot ecdc4252c2 Merge "Do not assume that UTPage exists in ApiVisualEditorTest" 2023-08-07 21:00:20 +00:00
jenkins-bot 2fb87f11e0 Merge "Add option to unify display of VE enable preference" 2023-08-07 15:33:40 +00:00
jenkins-bot 5d079c2012 Merge "Fix conditions for 'visualeditor-autodisable' that depended on WMF config" 2023-08-07 15:31:52 +00:00
Daimona Eaytoy e3a2b537ca Do not assume that UTPage exists in ApiVisualEditorTest
Create a test page explicitly, specifying the expected content as well.

Bug: T342428
Change-Id: I5a6e211fe6d36b6bf0576d1739b7fbc2cf49495b
2023-08-07 16:33:53 +02:00
Translation updater bot 44d0e6f50f Localisation updates from https://translatewiki.net.
Change-Id: I73d6ee05d6b54ec06146f38333e049f6ab3b8bc1
2023-08-07 08:40:19 +02:00
Translation updater bot caa43546af Localisation updates from https://translatewiki.net.
Change-Id: I9f83bccbc29be5a4d61597399efef88794b68a1a
2023-08-04 09:21:28 +02:00
jenkins-bot e2efe5079a Merge "Use different tooltips for ca-edit and ca-ve-edit links" 2023-08-03 15:53:21 +00:00
Translation updater bot ab05a0a951 Localisation updates from https://translatewiki.net.
Change-Id: I343ad68f867d01454efe1f3c232dc525ec63519e
2023-08-03 08:49:18 +02:00
Dringsim cce52fae65 Use different tooltips for ca-edit and ca-ve-edit links
Bug: T337653
Bug: T341424
Change-Id: I3aa79fec71ca2c40a0ece3ca73dd934cf6c9d5a8
2023-08-02 16:36:54 +00:00
Martin Urbanec 35320775e3 ApiVisualEditorEdit: Make tags param actually work
Why:
ApiVisualEditorEdit passes most of its params down to
action=edit. However, $params contains parsed version
of the params. Using it with tags results in the param
validator logic on ApiEdit's end receiving a PHP array,
which it does not expect (neither it should; it is impossible
to pass one via an actual API call).

This feature will be used in DiscussionTools,
which itself reuses ApiVisualEditorEdit.

What:
Use WebRequest::getText() to get the unparsed
value for 'tags', which makes the parameter
forwarding actually work.

Bug: T343339
Change-Id: I0ac60ca8473fe28461b2da60f9911baac4994388
2023-08-02 17:52:11 +02:00
Translation updater bot 3241a2ab86 Localisation updates from https://translatewiki.net.
Change-Id: Idd0979149d1792fff8e86aaeeb2e593b880d133c
2023-08-02 09:04:57 +02:00
Translation updater bot bd7acbc677 Localisation updates from https://translatewiki.net.
Change-Id: I407d28affcffa7d0ab431e2d82f87821105e48e3
2023-08-01 08:37:25 +02:00
Ed Sanders 85d584930f Simplify definition of textStyle group in toolbar
This makes it easier for 3rd parties to insert extra tools
in sensible places.

Change-Id: I6c8d0c96f53655d8f9ae9f01e5d0e1a1678d29a1
Depends-On: Ib8882fa6319915d291b345a69ab95f362739ad7b
2023-07-31 11:06:18 +00:00
Bartosz Dziewoński cbc750206d Update VE core submodule to master (c1420586c)
New changes:
3455d232c Localisation updates from https://translatewiki.net.
1eaffb772 Tests: Add missing close tag
f1a3a4da3 Localisation updates from https://translatewiki.net.
2b3eaa29d Localisation updates from https://translatewiki.net.
02007e7f0 i18n: Add new langauge
d80bb492e Revert "Patch WindowManager fix for multiple window managers"
ae097d2ad Follow-up I8701829: Manually move focus when tab/shift+tab pressed
67a3fac86 ve.ce.Surface: Move some vars closer to usage
ad7651f5a Handle clicking on a focusable node that is already focused
bec0946f2 Make Language and ClearAnnotation tools part of the textStyle group

Bug: T341681
Bug: T341687
Change-Id: I1752db8ff2f683b6cc0631324df6d4f25fd522fd
2023-07-31 13:05:24 +02:00
jenkins-bot 16623ac116 Merge "Simplify code for showing "Loading" message in template context" 2023-07-31 10:16:40 +00:00
Translation updater bot 5a4be2957f Localisation updates from https://translatewiki.net.
Change-Id: I94eb5376139c93e9797d5f59f7d53cad313c45df
2023-07-31 09:02:09 +02:00