Commit graph

100 commits

Author SHA1 Message Date
Krenair f8d609a8c7 Add class name to protected pages, to allow for specific CSS styling of edit area
Also get rid of checking for NS_MEDIAWIKI explictly and use
MWNamespace::getRestrictionLevels instead

Bug: 50783
Change-Id: I5986ddb9b6f17e4a2aca12dbb551cce4a6cfd663
2014-04-30 13:59:30 -07:00
jenkins-bot 09d8df88d1 Merge "Apply PST when generating diff" 2014-04-23 20:03:08 +00:00
Krenair c32880049f Apply PST when generating diff
Bug: 52345
Change-Id: Ic676105d230baf77994224bd64ed40cb52bb2e8b
2014-04-23 20:49:39 +01:00
jenkins-bot 61674b4631 Merge "Check cascade protection and show notice if relevant" 2014-04-23 18:24:10 +00:00
jenkins-bot c034e31404 Merge "Show notice if user is globally blocked" 2014-04-22 23:02:26 +00:00
Krenair 820ff5e8a0 Check cascade protection and show notice if relevant
Bug: 53893
Change-Id: Ie34c193da5ae41db1908afae35e5ba4949630176
2014-04-22 19:36:57 +01:00
Alex Monk cb9022bfe3 Show notice if user is globally blocked
Bug: 53009
Change-Id: I5c8a31f40535e7495133738a03d83648d57fb526
2014-04-22 01:22:48 +01:00
jenkins-bot a24cffed00 Merge "Set context title when rendering edit notices and checkboxes" 2014-04-19 03:48:53 +00:00
Roan Kattouw ddb8d826e3 Set context title when rendering edit notices and checkboxes
Bug: 59608
Bug: 63600
Change-Id: Ia2fdb3b3d383415feaf122d235d0c9a9e0ba0900
2014-04-19 03:09:28 +01:00
Ed Sanders 509b3db9ba Use Parsoid API for action=parsefragment
Bug: 48524
Change-Id: I8a61d2fab87d2a2e88ec2f3bbdef9ede1c7ad773
2014-04-18 13:19:54 -07:00
Ed Sanders 46988b2bd4 Create requestParsoid method for all requests to Parsoid API
Merges logic for GET & POST requests.

Change-Id: I17578177a6fc28b32f7d41c7ca6e6cf4ccaab9d9
2014-04-18 13:17:02 -07:00
Niklas Laxström dc4015455b Remove getVersion from api module
This method is deprecated since 1.21, VE is marked to require 1.22.

Change-Id: I67d30777fe0b2ebdacffcb2d6ca92275321c4e68
2014-04-17 14:04:21 +00:00
Niklas Laxström 32446f3cb3 Add whitespace
Change-Id: Id4448bcd952b1b9664cf74a99be80b8129fafa4d
2014-04-17 14:03:46 +00:00
jenkins-bot 797430e9ef Merge "Kill $wgVisualEditorEditNotices" 2014-03-27 18:34:39 +00:00
jenkins-bot b55d28bd24 Merge "Show blockedtext message in edit notices" 2014-03-26 23:02:24 +00:00
Krenair f1afe2fb48 Kill $wgVisualEditorEditNotices
Global that isn't used outside of this function.

Change-Id: Ie967523df5d61491e0042ed159c59e45439bf19e
2014-03-26 22:23:58 +00:00
jenkins-bot d9741aef73 Merge "Update use of newarticletext for added parameter" 2014-03-26 22:00:43 +00:00
jenkins-bot 58f5c76f46 Merge "Block non-JSON API access to VisualEditor, as it won't work" 2014-03-26 21:49:02 +00:00
Krenair d23d2a5853 Update use of newarticletext for added parameter
I999b9772 added a new parameter to the message, since then VE has just
been pointing this link to $1.

Bug: 63146
Change-Id: Icbaa79e6db9536c5bba2b8b3537f0920b0439f52
2014-03-26 21:34:52 +00:00
Krenair 2dcb2419dd Possibly show blocked-notice-logextract or userpage-userdoesnotexist when editing a user page
Bug is just about blocked-notice-logextract, but the same EditPage code also deals with
userpage-userdoesnotexist so lets deal with that too while we're here as it's trivial.

Bug: 51454
Change-Id: Ic8a8f135c9f76f645c25a31d9432b5e2786dcfa0
2014-03-26 14:19:53 -07:00
James D. Forrester 64a0c983a9 Block non-JSON API access to VisualEditor, as it won't work
Bug: 61017
Change-Id: I1d8f4509fc012bf5da91d2fd431651e55291edfa
2014-03-24 18:25:57 -07:00
Krenair aec9279d84 Show blockedtext message in edit notices
Depends on If5b7ef401 in oojs-ui

Bug: 52004
Change-Id: Icf672dfec4f57bef3e485428d07759ab51470999
2014-03-24 15:13:30 -07:00
Roan Kattouw 78a52f1f80 Display links to nonexistent pages as red
* Add ve.init.mw.LinkCache to track page existence and
  transparently query it
* Populate it with initial data from the parser cache
  if available, obtained in the VE API module
* Use linkCache data in link annotation rendering

This doesn't yet integrate the LinkCache with other
components like the link inspector. That should be
done so we can deduplicate the existence checks.

Additionally, we should generalize LinkCache and use
it for the category existence/status checks as well.

Bug: 37901
Change-Id: I9fd43e8c3864dd375cf6dadfdeedd05e4fe9cf3b
2014-03-20 02:42:33 +00:00
Krenair 438f9df04f Show last protection log entry and link to full protection log on protection notice
Bug: 51215
Change-Id: I95e50451003f24bd37a2125dd21dbffcdd4fcafa
2014-03-17 22:17:17 +00:00
James D. Forrester 831141e692 Pass 'pst' as true in parse request for fragments
In our parse request for 'wikitext fragments', used in the transclusion dialog
and extension inspectors, we weren't passing 'pst' as true, so while [[Foo|Bar]]
came back as expected, [[Foo (bar)|]] just came back as plain text, confusing
users.

Bug: 60998
Change-Id: I9931ad8034273ceb19c027d5035c63422cc0e570
2014-02-11 17:06:26 -08:00
Antoine Musso ae5e922837 Global setting for Parsoid HTTP proxy
On sites using $wgHTTPProxy, any curl requests made via MWHttpRequest
would be passed through that proxy. The Parsoid daemon is most probably
reachable directly, hence we want to be able to disable the proxy.
This can be done using the new $wgVisualEditorParsoidHTTPProxy which is
passed to MWHttpRequest in VisualEditor API.

Change-Id: I855249950b1b368ae0afe662154eb48e5b1a14f2
2014-02-07 14:45:56 -08:00
Ed Sanders c74d7f1a21 Update categories HTML on page save
Because there's an API for that.

Bug: 48560
Change-Id: I410647d2b1aa740f606ddca64052b8d2b54671bf
2014-01-12 14:55:39 +00:00
Rob Moen 3577ca7f6d Provide content format faux reqeust now that content format is validated
Related core change: I6c1bb9774542e39bfb899a47.

Bug: 59867
Change-Id: I5cc44c5ef358d9b19e9964545be29662083bd55c
2014-01-09 21:29:37 +00:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08:00
Ed Sanders 1a5bdd5bd2 Show full language names in the MW language dialog
Bug: 54086
Change-Id: I099ac552638d666a447eb3aeaef68329ffacdfce
2013-12-06 13:10:33 +00:00
Roan Kattouw 0f21329770 Implement serialization cache in VisualEditor API
Add paction=serializeforcache, which serializes the given HTML, stores
the resulting wikitext in memcached, and returns a cache key. This
cache key can then be passed instead of HTML to paction=diff or
action=visualeditoredit for quick diff/save operations using the
cached wikitext, or to paction=serialize to just retrieve the wikitext.

This lays the groundwork for front-loading serialization in the editor,
and for avoiding the double serialization that occurs when the user
first views the diff, then saves.


Bug: 55979
Bug: 56011
Change-Id: I223b1717890632c39e2509967149551f807119f8
2013-11-20 10:26:47 +00:00
Roan Kattouw 6eabc783c3 Support private wikis by forwarding Cookie: headers to Parsoid
If configured to do so, the VE API will forward the Cookie: header to
Parsoid. This allows VisualEditor to be used on read-restricted wikis.

Bug: 44483
Change-Id: If4a0cf1e5785b332ec9b014b783412805cf8af75
2013-11-01 11:14:04 -07:00
Ori Livneh 370186ead1 Change X-Parsoid-Performance header value indicating cached response
The header should comprise 'key=value; ' pairs rather than 'key: value', and
the key name 'cached-response' is less tied to the particulars of the current
Parsoid storage setup (which is being revised). Follows I8085fdba3.

Change-Id: I8bcf947763512ba700793974ab0c48d65c171bbb
2013-10-06 23:30:27 +00:00
Ori Livneh 397b458e86 Have API pass through 'X-Parsoid-Performance' header from Parsoid
Change I1d7fd94f2 to Parsoid adds a custom header on Parsoid HTTP responses,
'X-Parsoid-Performance', which contains data about how long it took Parsoid to
handle the request. This patch makes the API pass through the header from
Parsoid to the client, where it will be logged as an event (along with
additional datapoints that are only available on the client). When the request
is fulfilled entirely by Varnish, the XPP value is replaced with
'backend-varnish-hit: true'.

Change-Id: I8085fdba35c860eaaa4df020d06d1d45d4ea5813
2013-10-04 19:03:08 +00:00
Timo Tijhof 9e687efdf9 ve.ce.MWTransclusionNode: Check for API errors
See ApiVisualEditor.php#parsefragment.

Error code is also incorrectly about Parsoid, method
parseWikitextFragment does a FauxRequest to MediaWiki. Fixed
error.info. Keeping the same error.code for now for consistency.

Bug: 52483
Change-Id: Ic473ae4a5c1e9706140f6ec4cc8157fadd02c318
2013-08-03 00:35:42 +02:00
Roan Kattouw 1c4c86e7e3 Fix notice caused by not passing the WebRequest object by reference
It makes no sense that we should have to pass this by reference but
if we don't do it, we get a PHP notice.

Bug: 52466
Change-Id: Ibc8e33c4776a325cd32b6526dacc200994a73f7f
2013-08-02 11:37:30 -07:00
Ed Sanders 67dbf621b6 Show newarticletext(anon) when creating a new page
Bug: 51459
Change-Id: Id8509c6c8b92a0355b97d7661affe749fcdfdcba
2013-07-24 10:43:21 +01:00
Roan Kattouw 393807462e Render check boxes from EditPage
EditPage has a lovely getCheckboxes() function which includes the
minor and watch checkboxes as rendered by MW core, as well as any
checkboxes extensions like FlaggedRevs might have added. Output
these in the API, render them, and send their values back.

ApiVisualEditor.php:
* Build a fake EditPage, get its checkboxes, and return them

ApiVisualEditorEdit.php:
* Pass through posted request data to ApiEdit, which passes it
  through to EditPage thanks to Idab5b524b0e3 in core

ve.init.mw.ViewPageTarget.js:
* Remove minor and watch checkboxes from the save dialog template
  and replace them with a generic checkbox container
* Have getSaveOptions() pull the state of all checkboxes in
** Special-case minor and watch, and pass the rest straight through
** Move normalization from true/false to presence/absence here, from
   ve.init.mw.Target.prototype.save(), because here we know which ones
   are checkboxes and we don't know that in save() without
   special-casing
* Remove getSaveDialogHtml(), we don't need to hide checkboxes based on
  rights anymore because in that case the API just won't send them to us.
** Moved logic for checking the watch checkbox down to where the same
   logic for the minor checkbox already is
* Unwrap getSaveDialogHtml() in setupSaveDialog()
* Access minor and watch by their new IDs throughout

ve.init.mw.Target.js:
* Get and store checkboxes from the API
* Pass all keys straight through to the API

Bug: 49699
Change-Id: I09d02a42b05146bc9b7080ab38338ae869bf15e3
2013-07-24 00:02:14 -07:00
Timo Tijhof 114011bf95 API: Remove loading of unused globals
* non-edit doesn't use $wgVisualEditorUseChangeTagging.
* edit doesn't use $wgVisualEditorEditNotices.

Change-Id: I4ebbf855ca92ca1541013ce68a58e019b405137f
2013-07-12 18:37:22 +02:00
Timo Tijhof 46f40dc696 api: Split save action into separate API module
This allows us to make the token no longer a requirement
for non-save actions while still using the built-in system
for token verification.

Update documentation for "oldid" since it is not required even
outside (paction=save). In fact, if we require it VE loading
fails because it doesn't pass oldid unless it has to when
restoring a specific version.

Bug: 50424
Change-Id: I7b1b50a43648b1cc40a984340846efdb0ba2ecc9
2013-07-11 15:37:23 -07:00
Rob Moen b990b50b9a Add notices for pages protected from creation
Change-Id: I829c104e1c62e0ad2b48d526447b1ede8408bc6f
2013-07-10 14:24:02 -07:00
Rob Moen f37f0a686b Add protected & semiprotected notices to api.
Bug: 50415
Change-Id: I2966a31b909e44aa371dfe84cb68c264420e35a7
2013-07-10 13:56:11 -07:00
Timo Tijhof d16fef546a mw.ViewPageTarget: Fix incorrect retention of the wrong oldid
* Only pass the oldid to the API from #load if we restoring from
  oldid in the url. Otherwise load the latest version.
* Setting 'restoring' from mw.Target instead of mw.ViewPageTarget
  so that we don't rely on mw.ViewPageTarget in mw.Target#load.
* Fix the API to not require 'oldid' to be passed.
* Fix the API to actually return the 'newrevid' property. It
  was doing a no-op on a $result that is never used due to the
  same variable being overwritten with the result of parseWikitext.
* Moved updating of wgCurRevisionId to mw.ViewPageTarget as it
  belongs there (possible future inline editors probably act
  on a different page than the main one). Also made it only
  update if it isn't undefined, so that a null edit doesn't
  result in wgCurRevisionId being unset.

Bug: 49943
Bug: 50441
Change-Id: I221e5038f95eadf6d87013e80f12394f0376a293
2013-07-08 16:11:23 -07:00
Timo Tijhof 4e546796aa mw: Implement support for ConfirmEdit and FancyCaptcha
* 'captcha' property from ConfirmEdit API is already exposed
  in ApiEdit and ApiVisualEditor through the 'edit' property
  in our response data.
* Add parameters 'captchaid' and 'captchaword' to ApiVisualEditor
  and mw.ViewPageTarget#getSaveOptions. ApiVisualEditor will
  forward these to ApiEdit which forwards them to FancyCaptcha.
* We display the captcha through a saveDialog warning.

Bug: 50356
Change-Id: Ia7d2102cba89d00ec8508e846061023b330ece4f
2013-06-29 20:42:23 -07:00
Timo Tijhof a800509cd0 ApiVisualEditor: Rename editResult to result
$editResult is confusing as it is the same as ['edit']['result']
as one would expect.

Change-Id: I8cf39359307f39450f53331ce885d2ad420168ce
2013-06-28 16:08:15 -07:00
Timo Tijhof f1ab7c1b09 ApiVisualEditor: Separate save/diff switch case
They no longer overlap (except for 3 lines of code). The
double switch case for save/diff 90% of the body being if-save
and elseif-diff doesn't make sense.

Change-Id: Ic6f014393e72901bb5ab4449d946d94b87429e52
2013-06-28 15:54:55 -07:00
Roan Kattouw f538fcf6be mw.ViewPageTarget: Add sanity check for DOM roundtrip
The sanity check converts the linear model back to DOM, then
compares this DOM to the original DOM and rejects the deferred
if they are not equal.

The DOM creation has to be done synchronously (before we unlock
the surface), but the actual comparsion can be (and is) done
asynchronously.

To make the UI flow of the save dialog easier we just keep the
save button on the toolbar itself disabled until the sanity
check is done. Though this should finish before the user starts
editing the document (let alone start saving), we do add a class
to the button to indicate a progress cursor.

To simulate a slow sanity check, set the setTimeout in
startSanityCheck to 5000, load VE, make a change, hover the
button, and see it change from disabled + progress-cursor to
enabled after 5 seconds.

To simulate the sanity check failing, change !== to === in
the first "if" in startSanityCheck.

Bug: 47521
Bug: 50067
Change-Id: I04f71fe8e00c6257fbc953cc9de3323e24709b0f
2013-06-27 19:20:14 -07:00
Roan Kattouw 6503849777 Use the latest revision's timestamp for basetimestamp
Bug: 49390
Change-Id: Icacaa5101386e52309278c8d9871ca1193aa86a9
2013-06-18 12:17:44 -07:00
Gabriel Wicke 0b558e0d09 Disable the 'cache' query parameter too
With explicit cache management on the Parsoid side there is no need to send
this explicitly any more.

Change-Id: I34bf3a6ffe631d3350c05ec4c21563f8a734effc
2013-06-10 15:41:49 -07:00
Gabriel Wicke e655c80bc0 Disable Parsoid URL cache busting with touched ts
The Parsoid extension now keeps the cache for the current oldid up to date.
Removing the touched parameter lets VE use the cached HTML.

Change-Id: Id025c69060cb9a0bc2478ec49e2c436022049d97
2013-06-07 16:57:48 -07:00