RollbackAction: Implement AJAX interface and require POST
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 29 Sep 2015 02:53:20 +0000 (19:53 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 23 May 2016 19:00:48 +0000 (20:00 +0100)
commit9af38c046c86a51f82891225e3ea6833566302d4
treeb74e1e9b14efd28fac8cf87199f875404238fd3f
parentb09bfb7bf6b811f9657a606d611a7f889a5e013e
RollbackAction: Implement AJAX interface and require POST

Similar to WatchAction (converted in commit 77cdf1919).

* Make FormAction::getFormFields not abstract.
  In most cases this will just be an empty array.

* Convert RollbackAction from FormlessAction to FormAction and implement the
  required error handling scenarios (mostly moved out of from the old method, or
  duplicated from the WikiPage method where necessary).

* In most cases the in-between form is never used since a JavaScript handler
  takes over the link and uses the API over AJAX instead. In the no-js fallback
  (as well as for any existing tokenless rollback links) copy the GET parameters
  into the form for re-submission as POST (plus token, added by HTMLForm).

* Remove the distinction between WebUI and API tokens. This stronger token salt made it
  unnecessarily complex and was only there because it used GET until now. This streamlining of
  tokens matches what we already do for 'watch', 'edit', 'patrol' and other actions.

* Fix form submission bugs when 'from' query parameter is missing.

  - Ensure the required 'from' query parameter is present before showing a form.
    No need for the user to submit a form we know will fail.

  - Plain GET request to action=rollback (with no parameters) is now a 400 Bad Request
    instead of a form that would fail when submitted.

  - Submitting the form without 'form' field now correctly says why it failed.
    Previously it emitted a session error, which was a lie.

Bug: T88044
Change-Id: Ia457802fec2e90573c8e7d552bc1f3cee258f10b
12 files changed:
RELEASE-NOTES-1.28
includes/Linker.php
includes/actions/RollbackAction.php
includes/api/ApiRollback.php
includes/page/WikiPage.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki/api/rollback.js [new file with mode: 0644]
resources/src/mediawiki/page/patrol.ajax.js
resources/src/mediawiki/page/rollback.js [new file with mode: 0644]
resources/src/mediawiki/page/watch.js