Commit graph

160 commits

Author SHA1 Message Date
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 9ce8ae05c7 ApiVisualEditor: Add logging for RESTBase HTTP errors
Bug: T233127
Change-Id: Ide5138d8f8f462b9c3d7da10f26ff57c9d17f1c9
2019-10-02 01:00:32 +02:00
Bartosz Dziewoński ca3c887e36 Fix loading icons for historical diff mode switcher
The 'eye' icon is in the 'accessibility' pack, not 'alerts'.
Compare to the dependencies of 'ext.visualEditor.diffPage.init'.

Change-Id: Ie14ab6be756fd9e0bef59475466674a41273046f
2019-10-01 03:31:27 +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
Bartosz Dziewoński c0eb57ed3b Remove Phan suppression for a fixed false positive
Unnecessary suppression causes build failures. Probably fixed by the
EditPage.php changes in e2e543f7c2a98f40c9b43ba3989d0f6689f4cb67.

Change-Id: I2ac7e95886ce6bef2ba08e1614728caae7d26442
2019-09-02 21:50:16 +02:00
Ed Sanders e5f5a49344 Support for defined template context items
Context items can be created for specific template titles. Titles
are mapped to context items using an on-wiki message.

Bug: T211243
Change-Id: Icfc39e350452da238d0e0c17cb2305c60d9ca16a
2019-08-30 13:02:47 +01:00
Petr Pchelko c0d2d52e95 Remove usages of deprecated MWNamespace.
Bug: T11977
Change-Id: I6da497464a77286d5fd2d30a85e70de85fe1c868
2019-08-26 17:49:52 -07: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 393de5985f Update VE core submodule to abf2bfa85e64e67cdf963601fe1da2a11fd9e89a
New changes:
1a7460058 Remove ve.newMobileContext feature flag

Local changes:
* Remove ve.newMobileContext feature flag

Change-Id: Ia8def997b7cba4623866080752b06068d2118cc3
2019-07-23 22:12:48 +00:00
daniel b898c417b4 Removes forward-compat code needed for method rename in core.
Depends-On: If47a93878f87d69800e5f305404c22528dac5e94
Change-Id: I2181f1a39b47078a32a8de68ac63d3144fc5b807
2019-07-23 21:38:52 +02:00
Ed Sanders df8feb6faf Move mobile context to bottom of page
Hidden behind ve.newMobileContext feature flag.

Bug: T204733
Depends-On: Id276686a0e82c12c457c81eaec9939722c65c7ec
Depends-On: Id5f7ead769dc30c0fbd2a8b8f6f6c4d68dcfabac
Change-Id: Ibd4b699dfe4bb9bcaec6898b6b82357eb287d128
2019-06-14 20:57:22 +00:00
Umherirrender e1442aa343 Add phan
Change-Id: I7352036536c1c8415b681f48f3ee0dcec315c035
2019-05-31 14:48:22 +00:00
Thalia cdb3b880af Use MediaWiki\Block\DatabaseBlock instead of Block
This follows the rename of the Block class in I6d96b63ca0.

Change-Id: Ib652feb34b7f10726ec775ff2929ca12ed66a8e1
2019-05-31 15:34:00 +01:00
Bartosz Dziewoński 8ae4925676 Allow switching from WTE to VE with changes in non-RESTBase mode
* Change the query in ve.init.mw.ArticleTargetLoader#requestParsoidData
  so that in non-RESTBase mode with wikitext it still returns the
  metadata required to initialize the editor, using the backend API
  code added in I1b35b28e428a1f86d2e34d90ddbe73361ce14818. This fixes
  the exception from T222312.

* Introduce new configuration option $wgVisualEditorAllowLossySwitching
  to control this feature. It is enabled by default, fixing T214542.
  We allow it to be disabled because switching in non-RESTBase mode may
  cause "dirty diffs" (non-semantic changes to the wikitext), which are
  undesirable on wikis where users carefully review all changes.

Bug: T214542
Bug: T222312
Change-Id: I58879cba5612002c70c24731306214d2577c2c52
2019-05-30 20:18:53 +02:00
Umherirrender c9c4b68d25 Remove class_exists by ExtensionRegistry check for ConfirmEdit extension
Change-Id: I6ffb1842600316f2a6309a0028e96e75fe75f0c8
2019-05-29 12:10:02 -07:00
Ed Sanders 4a692e762d Special-case redlink URLs to load preferred editor
In general action=edit could be bound to a wikitext-specific
edit link, but in the case of redlinks we can use the
preferred editor instead.

Bug: T223793
Change-Id: Ib0851e9e2ce441ae93311153801e2c3de0a2063d
2019-05-26 17:55:38 +01:00
jenkins-bot e6d885789e Merge "Check if page is really editable and call #setReadOnly accordingly" 2019-05-18 18:10:59 +00:00
Bartosz Dziewoński 222ada6a8e VisualEditorHooks: Mark the 'preview' parameter as unsupported
We don't currently support it in NWE. It has a very different design
for previews that wouldn't really do what users expect. Let the old
editor handle this.

Bug: T195914
Change-Id: If0c0312347c212447bd8da7336c80bd4a1cb246a
2019-05-18 19:08:31 +02:00
Bartosz Dziewoński b9835f75d3 Check if page is really editable and call #setReadOnly accordingly
There are various circumstances where the wgIsProbablyEditable check
gives incorrect results (hence the 'probably'):

* User is blocked (T111217)
* Page is protected from creation (T173763)
* Page is transcluded on a cascade-protected page (T217217)

Bug: T111217
Bug: T173763
Bug: T217217
Change-Id: I7df8909c31f29d2e7521bef8612c27cb61146a4d
2019-05-18 17:23:31 +02:00
Ed Sanders 3285b7dbe5 Initialize $restbaseHeaders to null
Bug: T223281
Change-Id: I8bead40c35323cd4082f55ac529f900403f76f37
2019-05-14 16:07:22 +01:00
Bartosz Dziewoński a76d3daf54 DesktopArticleTarget.init: Allow veaction=edit to override namespace settings
Prior to 80bfbfc54b this worked by
accident, and with a number of bugs depending on your settings (see
T219457). It turns out that Wikipedia users have invented various
workflows that depended on this bug (mostly involving sandbox pages in
namespaces where VE is not enabled). Restore it as a supported
feature, and in a way that avoids the problems it previously caused.

Bug: T221892
Change-Id: I62714b6f2905efd1d1b34c7a13b9917cb6c609fc
2019-05-14 00:18:47 +02:00
Bartosz Dziewoński e48e7d95ec VisualEditorHooks: Use isVisualAvailable() when changing tabs/editsections
Change-Id: I93f00005eb3f58302d46c14259016c4cee625a18
2019-05-14 00:18:35 +02: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
daniel a15875e247 Add forward compat hack for getBlockInfo/getBlockAsResultStructure
This is necessary to allow the unmitigated removal of
ApiQueryUserInfo::getBlockInfo to be fixed. See discussion on
I84ed21641c44b2f65.

Change-Id: I9f40666a31bd4af50762c197c2ce5bf089a5e68c
2019-05-10 22:08:36 +02:00
jenkins-bot bc5b0c93dd Merge "Replace usage of deprecated ConfigFactory::getDefaultInstance()" 2019-05-08 22:27:31 +00:00
Bartosz Dziewoński 636531808c ApiVisualEditor: Fix use of getBlockInfo()
The method ApiQueryUserInfo::getBlockInfo() was removed in unannounced
breaking change in MW core: I84ed21641c44b2f65ebe1980b0893d1846db3b34.
Apparently we're supposed to use the method from ApiBlockInfoTrait now.

Bug: T209599
Change-Id: I7ab5492310980b1527c7329faf65655330b8bef0
2019-05-08 22:36:38 +02:00
Marko Obrovac c32bce5add ArticleTargetLoader: Add stash=true query param to RB HTML fetching
RESTBase is changing the way it is storing HTML/data-parsoid renders. In
order to still support VE (and other editors) with quick access to HTML
and matching data-parsoid (needed later for transforming the modified
HTML to wikitext), VE now needs to let RESTBase know it intends to
perform a transformation call later on. In that case, RESTBase will make
sure to keep the matching data-aprsoid around for long enough.

Bug: T222639
Change-Id: I02672e29bd0f331794fd77d9e56f9cc6822d9b9e
2019-05-08 13:30:01 +02:00
Derick Alangi cf663a40b4 Replace usage of deprecated ConfigFactory::getDefaultInstance()
Is replaced by MediaWikiServices::getInstance()->getConfigFactory().
Also, did a few minor cleanups where necessary such as; objects are
passed as references by default etc.

Change-Id: I42cd242ebdbc0b091a99e771289020d498bf2bba
2019-05-04 22:02:29 +01:00
jenkins-bot f6a8a097f2 Merge "DesktopArticleTargetInitModule: Avoid expensive $msg->exists check" 2019-05-01 17:28:00 +00:00
Ed Sanders fae9fcb70c ApiVisualEditor: Return structured block info as well as formatted notice
Mobile builds its own block message from the block information,
rather than using parseAsBlock.

Bug: T209599
Change-Id: I8b200f258b50f7048aded22ec7ab81a49937c5a9
2019-04-30 20:41:03 +00:00
jenkins-bot fa50329f62 Merge "Use PageEditStash services instead of static methods" 2019-04-24 15:11:19 +00:00
Aaron Schulz e2fa08f0f8 Use PageEditStash services instead of static methods
Change-Id: I1bcda750a22dcacfffa0f7400411a7653806a82e
2019-04-23 12:45:21 -07:00
Dayllan Maza 96de1353d3 Remove block notice tracking
This is a clean up after collecting the necessary data related to
blocks and how often users see the block notices

See: https://phabricator.wikimedia.org/T189724

Bug: T214214
Change-Id: I532a0cd95009109ba25caa8dd31badd5c1900da7
2019-04-23 11:31:37 -04:00
Timo Tijhof 139b5b879a DesktopArticleTargetInitModule: Avoid expensive $msg->exists check
This check currently requires LCStore, MessageCache, and (sometimes)
Database to involved to check whether the message and/or local override
exist.

Using `useDatabase(false)` should take away most of this cost
by no longer performing the multiple Memcached/Database roundtrips,
and leaving only a cheap in-process check on LCStore.

Bug: T221294
Change-Id: I6bf47cd84cdf9bfdd63bee0a613425bb79595e4f
2019-04-17 23:12:53 +01:00
jenkins-bot 9a8a0592de Merge "VisualEditorHooks: Remove redundant $resourceModules check" 2019-04-17 19:03:12 +00:00
Timo Tijhof ff5f688405 DataModule: Use module->getConfig instead of rl->getConfig
The latter is being deprecated as of I74a9535918e because it was
almost never used intentionally. When module objects are created,
the appropriate context object is injected via setConfig. That is
the one the modules should use.

The context object has a reference to the ResourceLoader object
(although unsure why actually), but shouldn't be used for this
purpose as there could be a 1 to many relationships further down
towards modules.

Change-Id: Icab0f12141a46476618f984d4548a82fdae33275
2019-04-17 17:33:53 +00:00
Timo Tijhof afdd1b5fca VisualEditorHooks: Remove redundant $resourceModules check
For a while now, the 'ResourceLoaderRegisterModules' hook is
the last oppertunity to register modules. Therefore, the
isModuleRegistered() check covers everything it needs to.

In addition, at this point modifications to ResourceModules would
be ignored even if it did contain additional entries.

Change-Id: I77714fca0f561f5817a45dd3be5fd8d3ba42f969
2019-04-17 15:20:13 +01:00
Timo Tijhof ef36f4b0a1 Move usePageImages/usePageDescriptions from page conf to site conf
These do not vary by user or page, and can thus be loaded asynchronously
via the startup module, rather than blocking rendering and fetching
of modules on all pages.

In a future change, it might be better to go a step further and bundle
these with a module so that they only load as-needed instead of still
on all page views, but this should be an improvement nonetheless.

Change-Id: Icae3712ac5546a90bc7ffd787b0f3285dff6a26f
2019-04-17 00:10:27 +01:00
Timo Tijhof cc599c2e36 init: Bundle wgVisualEditorUnsupportedEditParams with DesktopArticleTarget.init
Bug: T219342
Change-Id: I4b5a048779bd4b957cc5d99c3a7686363ffb3df9
2019-04-16 16:33:53 +02:00
Reedy 5a5af75c85 s/PreferencesForm/PreferencesFormOOUI/
Change-Id: I44a99ef1905c7c438da159d133b956d3488c0092
2019-04-14 01:47:03 +01:00
jenkins-bot 1b2c1425ee Merge "Allow external link pasting to be enabled by config" 2019-04-09 16:05:26 +00:00
James D. Forrester 4df2558910 Hooks: Don't set wgVisualEditorToolbarScrollOffset in RL when 0
We should also move this to packageFiles, but that's more work.

Bug: T220158
Change-Id: I438dc13802d744877921dc612b16cc22b0713e00
2019-04-05 11:42:05 -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
jenkins-bot aeeffb912a Merge "Treat ambiguous values in $wgVisualEditorAvailableNamespaces as names" 2019-04-02 15:20:59 +00:00
Derick Alangi 37e978d169 SpecialCollabPad: Remove unused variable $request
Change-Id: Ie5cce0771c2b7f1f5a521d3129deb2063b5cbf5b
2019-04-01 23:08:02 +01:00
Bartosz Dziewoński 018464a096 Treat ambiguous values in $wgVisualEditorAvailableNamespaces as names
The config option can contain either namespace names or IDs.

Bug: T219562
Change-Id: I6b3706ea7e26f69427ffac1603b093bcb8fdbd03
2019-03-29 01:08:03 +01:00
jenkins-bot d41366c452 Merge "Clean up serialization cache code a bit and add more metrics" 2019-03-28 17:49:51 +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
Bartosz Dziewoński 21e9db7d13 Respect user preference for default thumbnail size while editing
Bug: T69047
Change-Id: Ibf90d290df5634cd89651a427a6aa1c6f9d7a553
2019-03-26 22:15:26 +01:00