mediawiki.api.edit: Add edit() and create() methods
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 27 Jun 2016 16:08:34 +0000 (17:08 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 27 Jun 2016 18:08:43 +0000 (18:08 +0000)
commitaf9981495e6621343f2a90edd539d39d1cbd13a5
tree5790d8b87726b620d92c09e1a5fb57dd8baaa642
parent6af8dcf5763a67315d3b6e52fdea27fe7df952b5
mediawiki.api.edit: Add edit() and create() methods

Doing edits "The Right Way" is non-trivial due there being mulitple strict options that
need to be known and enabled. By default, the API encourages bad behaviour:

* Edit is unexpectedly saved as anon after session becomes invalid.
* Other edits are silently overwritten.
* Accidentally re-creates a deleted page.
* Accidentally creates a new page when an edit was intended (eg. if title was wrong).

Implement abstraction methods for edit and create that handle all this.
Thus guarding JS edits with the same protections as EditPage.

Change-Id: Ic6a35902cbae262971c704b9b8127e54733dac79
resources/src/mediawiki/api/edit.js
tests/qunit/QUnitTestResources.php
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.edit.test.js [new file with mode: 0644]