Commit graph

60 commits

Author SHA1 Message Date
Ed Sanders b9741d1cc2 Allow 'wikitext' to be an empty string in save API
Change-Id: Icdfd60c4a2de6a678cad995d5bcf80d07703537b
2016-11-19 14:09:16 +00:00
Ed Sanders dcbbaa79db Factor out getWikitext in ApiVisualEditorEdit
Change-Id: I0f6709f170034263acc94daa41603bcc77897d31
2016-11-01 16:24:40 +00:00
Roan Kattouw 13801bb6d3 ApiVisualEditor: Move diffing and serializing to ApiVisualEditorEdit
These require POST, especially paction=serializeforcachekey because
it calls ApiStashEdit::parseAndStash() which needs a master DB connection.
Move them to the edit module so we can require POST for that one and keep
allowing GET for the main module. This fixes the warnings we currently get
for using parseAndStash() in a module that does not require POST.

Change-Id: I64a8ed7305105fa4c46902b99984306a7ff468cc
2016-10-21 15:24:13 -07:00
jenkins-bot d20040aec0 Merge "Section editing in NWE" 2016-10-13 01:51:56 +00:00
Ed Sanders 4040442ad8 Section editing in NWE
Bug: T144654
Change-Id: Ida6e721e0d980b47e3fda6a1f0744cbce1b2235a
2016-10-12 12:55:11 -07:00
Alex Monk 418bd32217 NWE: Use a different change tag to the visual editor
Bug: T147587
Change-Id: If9b466ff8449ceeb0e71f9d36ea0b4ec8c1bae2d
2016-10-12 01:11:15 +01:00
Alex Monk 8a80b5bbc3 Split isAvailable from visual-specific checks
Not fully tested

Bug: T146182
Change-Id: I5d7ae6e49991660ecdc2daf46b319947f83a1018
2016-09-20 23:53:53 +01:00
Brad Jorsch d7247efc90 Remove pre-1.25 API compatibility code
Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: Iff2eeb2bbfba15c84a4fcec85b6647c28886e9aa
2016-09-20 15:32:23 -04:00
Ed Sanders c452e134cc Wikitext surface alpha feature
Edit wikitext with the VE interace.

Bug: T104479
Bug: T142138
Change-Id: Ic95b47e0dd378578555c4a2342ca9c87064ed1d5
2016-08-12 18:37:29 +00:00
Ed Sanders f1482627fa Factor out API deflation and change storeInSerializationCache API
Change-Id: I7e2e15a8ba5088e6c370cb035c71f7af18c13b61
2016-08-09 20:08:34 -07:00
Max Semenik 07da2af53f Fix undefined variable
Change-Id: Iba39e0a26a04cad28179aacd4f25b9aef1cfa7fc
2016-07-06 17:05:10 -07:00
jenkins-bot 026848c369 Merge "Fix display of subpage breadcrumbs show after save" 2016-06-29 16:41:05 +00:00
Alex Monk f69cc559b2 Tell the client whether we created a redirect or not properly.
Instead of letting the API formatter set it to empty string if so
or not set it at all if not, have it set to "1" if so or "" if not,
so the JS will handle it correctly.

Bug: T136546
Change-Id: I7308ab1efc1c3060606b61893432b685038192a9
2016-06-15 20:26:11 +01:00
Ed Sanders 216ef78cb0 [DEPRECATING CHANGE] Use canonical namespace names for enabling VE
These are more meaningful and the actual namespace IDs used can
vary, especially for extensions.

Change-Id: I781d484d7525ff09b5d348e79b63b161a7a26997
2016-05-04 18:56:00 +01:00
Alex Monk f6f048f31a Fix display of subpage breadcrumbs show after save
Bug: T97700
Change-Id: Ia576d32d0dd99d22ff2504b0e53cca3b7c82b811
Depends-On: Id27380de9577ad54cb2580b76a4f236e8dd491dd
2016-04-26 17:51:39 +01:00
Alex Monk 83ce0c3db3 Restore original WebRequest after we're finished messing with FlaggedRevs on save
Also mess with title so it actually appears to work again

Bug: T131633
Change-Id: I36229807d15f93879f8699a015d105815047eb6c
2016-04-16 13:25:35 +01:00
James D. Forrester e7a3ec43bf build: Update mediawiki-codesniffer to 0.6.0, add "composer fix"
Change-Id: Ic96081539c2ae98b5b239b59ca9b0362b337e522
2016-02-17 08:18:02 -08:00
James D. Forrester 8063603ca5 [BREAKING CHANGE] Drop MW pre-1.25 PHP API documentation compatibility
getDescription() and getParamDescription() have been replaced by a proper i18n-based
API documentation system since MediaWiki 1.25. Retaining these does not help us with
backwards-compatibility given that the repo already requires MediaWiki 1.27.0-alpha,
so just drop them before they become out of date.

Change-Id: Ic8b87235aeb7e1bcd7b24d5609c7d002658a66ba
2016-02-06 17:43:37 -08:00
James D. Forrester ada58df361 build: Bump file copyright notices for 2016
Change-Id: I3c618c196e504a80ca297a4132a17f1977a24fb7
2016-01-03 14:57:25 -08:00
Alex Monk 85b745666f Allow switching from wikitext to VE
Just by pressing the VE tab for now

Requires a relatively new version of restbase

Bug: T49779
Change-Id: I2a5294345f5e0f469c1dd1bdd29dbce211571a4e
2015-11-02 20:55:19 +00:00
Alex Monk 82b62896e1 Change a bunch of parsoid references to acknowledge that RESTBase is sometimes in the middle
Bug: T112339
Change-Id: I0eac521a89fc399de168408ef55c9143c0db742a
2015-09-14 21:18:01 +01:00
Frédéric Bolduc 0ce3baf66d mw.Target: Add jsconfigvars and modules to the save mechanism
* On save, VE will now fetch and append modules and jsconfigvars to the save
  event, which respectively contains necessary JS config module data and the
  list of required modules to be added on the page.
* The jsconfigvars are now properly added to mw.config on edit save.
* If any new modules are now required by the page after an edit, they will be
  loaded by ResourceLoader through mw.loader.load.

Change-Id: Ib3990078a22ad9e46debf3ce174e7cf27b86d944
2015-08-04 19:00:09 -07:00
Alex Monk ea34d938c8 Revert "Revert "Replace wgVisualEditorNamespaces with an associative array""
This reverts commit 7ca1afbbd2.

Bug: T104898
Change-Id: I061c1fd9ab8ec6b2afac92feef888ba207e1a9b1
2015-08-02 23:13:24 +01:00
Alex Monk 7ca1afbbd2 Revert "Replace wgVisualEditorNamespaces with an associative array"
This reverts commit 647a5597bb.

Change-Id: Idaf4960f5df2fbb426162830a15383ecfc96118e
2015-07-31 04:41:28 +01:00
jenkins-bot 4d95b6ea45 Merge "Replace wgVisualEditorNamespaces with an associative array" 2015-07-23 23:59:51 +00:00
Alex Monk 82fb5f609a Parse SpamBlacklist error on the server-side
The client won't be able to deal with templates etc.

Bug: T99830
Change-Id: I78611a3f061b1afd73de052aa9ddff48dc368f2d
2015-07-23 18:49:42 +00:00
Alex Monk 647a5597bb Replace wgVisualEditorNamespaces with an associative array
Bug: T104898
Change-Id: Ibf4812caeaa9290959bc757fc49a151854bff337
2015-07-23 18:49:21 +00:00
James D. Forrester 2b3dfdfe13 Set file permissions correctly for *.php files
Non-executable files should have permissions set to 644 – touching:

	ApiVisualEditorEdit.php
	VisualEditor.hooks.php
	VisualEditor.php

Bug: T104044
Change-Id: I73fcee410fa1d538e05a7f494871f20531665701
2015-06-26 18:41:01 -07:00
Aaron Schulz a948624dda Use more appropriate RecentChange_save hook for tagging
* At this point the IDs are all known so there is no need
  to re-query what was written in the transaction
* This works when recent change insertion is deferred
* Also deferred tagging in ApiVisualEditorEdit to after
  the RC row is saved

Bug: T100439
Change-Id: Ic4c7d8d89b8cfeee57eda867c0ff74fa9682ffc8
2015-05-27 13:28:01 -07:00
Brad Jorsch ccd2091f5d Further cleanup for core API change
PS25 and later changed things around a fair bit, meaning the previous update
needs some further updating. In some cases additional cleanup is also necessary
for future core API changes.

Bug: T96595
Change-Id: Iaac674f77079d29d42813fd69620bdce8905730f
2015-04-20 14:41:29 -04:00
Roan Kattouw 25c718bc96 Explicitly pass oldid to ApiParse after saving
If we don't explicitly pass the revid of the new revision we
just created, ApiParse will be lazy and get the latest revid
from the slave DB, which will probably be out of date.

Bug: T95466
Bug: T94367
Change-Id: I2149c7a710075eff9292d0c25ca40d10b325ad44
2015-04-08 13:48:30 -07:00
Roan Kattouw 25afae342a Move parseWikitext from ApiVisualEditor.php to ApiVisualEditorEdit.php
It's only actually being called in the latter.

Change-Id: Ifbf568738f38aa52878197813ec458c34bee5d5b
2015-03-14 00:27:11 +01:00
Roan Kattouw 237bb053d6 Remove the sanity check
It's slow, especially on large pages, and it's triggered
very infrequently these days, and only for known bugs.

In the future we should replace this with a debugging
interface that displays the DOM diff between the original
DOM and the round-tripped DOM, as opposed to the boolean
interface we have now.

By extension, this also means the visualeditor-needcheck
tag won't be applied to new edits any more, although
its registration and messages are kept around because
edits with this tag still exist in page histories.

Bug: T87161
Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
2015-02-17 17:14:34 -08:00
James D. Forrester 2f8b3e0d96 build: Bump copyright notices to 2015
Change-Id: Ie92dab7411116d3410195c3fb0a3513c664c0c30
2015-01-12 20:34:19 -08:00
Brad Jorsch c891a8e8b4 Update ApiResult handling for mediawiki/core change I7b37295e
Change I7b37295e for mediawiki/core deprecates several methods, and more
importantly changes the format of the data returned from
ApiResult::getData(). This change should handle these differences in a
backwards-compatible manner.

Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678e
2015-01-08 12:47:56 -05:00
Tim Starling 4c50307cd5 Fix duplicate wikitext parse for displaytitle
Instead of doing a whole new parse for displaytitle, just get it from
the same API action=parse internal request that is used for returning
the content HTML.

Also escape entities as in OutputPage::setPageTitle(). The format of
OutputPage::setPageTitle()/getPageTitle() is a bit confused -- it's
mostly treated as HTML, but Article::view() sets it to the unescaped
title text -- a historical error which was unfortunately wallpapered
over.

Change-Id: I387c1ccd9a75f9c6c6a006d83235c6c1c3d1ecb5
2014-12-10 09:50:59 +11:00
jenkins-bot e85550c350 Merge "Don't try to get newtimestamp from edit if no change was made" 2014-11-17 17:48:44 +00:00
Alex Monk a7294b34c0 Stop warnings about calling FlaggablePageView::setPageContent with no parameters
We don't care.

Bug: 73469
Change-Id: I2ff0ec2fd1b0d34c1168f83d808c1cb498b17511
2014-11-17 01:28:30 +00:00
Alex Monk ff3d76f488 Don't try to get newtimestamp from edit if no change was made
ApiEditPage can give us 'nochange' instead of the
'oldrevid'/'newrevid'/'newtimestamp' keys if we gave it a null edit.

Bug: 73463
Change-Id: Ic22597dfed11de3823471673404090a9bce12928
2014-11-17 01:03:00 +00:00
Alex Monk 581d1350e6 When saving, return the full contentSub to the client
And introduce code to make FlaggedRevs add its notices to contentSub.

Bug: 60718
Change-Id: Ibb91dc563ccf73d3b4bd1994134ccf02634fccb5
2014-11-12 17:36:59 +00:00
Alex Monk b2af92870a Update "page was last modified on date, at time" footer line when saving
Bug: 52403
Change-Id: I11e00066000e927f0551691d05fe11fe2ae125b0
2014-10-31 01:00:04 +00:00
Brad Jorsch 7d4ecc09c8 Add i18n for API module help
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
2014-10-29 13:59:41 -07:00
jenkins-bot 14e4a915d7 Merge "Use Config instead of globals" 2014-08-15 22:55:02 +00:00
Kunal Mehta 5575bed67c Use Config instead of globals
Change-Id: Iecf6358fcd15fe578b3e0dcdfa6022e0a1a763c8
2014-08-15 15:50:26 -07:00
Brad Jorsch 6dd98b5f3b Update token handling for MediaWiki API change
MediaWiki change I2793a3f2 changes API handling in a way that needs
updates to extensions for proper operation:
* needsToken() now returns a string
* Most custom token types are being replaced with a 'csrf' token (the
  former 'edit' token); any others need a new hook.
* All tokens must use a static salt. Compat with web UI using non-static
  tokens is supported and also serves to handle the now-deprecated token
  fetching.
* Documentation in getParamDescription() should return a string (not
  array) for 'token', as the signal to core that it should be replaced
  with a standardized message.

When compatibility with earlier versions of MediaWiki is no longer
maintained, the entry for 'token' from getAllowedParams() and
getParamDescription() may be removed, as may getTokenSalt(). This patch
leaves them in place.

Note this is intended to be compatible with earlier versions of
MediaWiki, and so should be safe to merge before the core change.

Change-Id: Ia6e512aae366996de4e73a8d7f4f03fcddd77286
2014-08-13 16:19:42 +00:00
jenkins-bot 01348dc05f Merge "Update displaytitle on save (try #3)" 2014-07-01 21:18:54 +00:00
Ed Sanders 288da5b704 Compress HTML data with deflate before POSTing
Bug: 66914
Change-Id: I7b0a9cfd4d4c10986769a868884688ffca833cb6
2014-06-24 17:39:03 +01:00
Alex Monk dc6840c3a0 Update displaytitle on save (try #3)
Parse the wikitext we already have.

This is mostly a revert of commit f84b880a54.

Bug: 50341
Change-Id: I312bafb0e7d61b0abd42d6ca7ea2e4b5dcdc61be
2014-06-23 15:32:15 +00:00
Alex Monk f84b880a54 Revert "Update displaytitle on save (try #2)"
This reverts commit b7401f838b.

Didn't break everything, but we should probably avoid this getting deployed until I can work out wtf is going wrong with it.

Change-Id: I048143239e998b30aba79fa395a0af1cb06c6a9b
2014-06-19 00:34:26 +00:00
Alex Monk b7401f838b Update displaytitle on save (try #2)
This reverts commit 5565ccca54.

I have no idea what is going wrong on deployment-prep to cause
the error in bug 66792. Let's try to find out.

Bug: 50341
Change-Id: I5041de838128bb55c57baddae01cdcb263626537
2014-06-19 00:04:51 +01:00