Commit graph

25 commits

Author SHA1 Message Date
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
Catrope 5565ccca54 Revert "Update displaytitle on save"
Causing HTTP 500 errors in ApiVisualEditorEdit.php (calling
getDisplayTitle() on a non-object).

This reverts commit dedc89b5ff.

Bug: 66792
Change-Id: Iaf438660f0623dc05f76294ad847b2fc5e25bed6
2014-06-18 20:21:10 +00:00
Krenair dedc89b5ff Update displaytitle on save
Also fix a couple of missing param docs

Bug: 50341
Change-Id: I1e73153dca5eb9343bbcda1fc2f9799e72f6f03c
2014-06-12 22:21:35 +01:00
Krenair c18fb662aa mw.ViewPageTarget: When saving a page as a redirect, update contentSub text
Or vice versa. Per my comment on bug 65621.

Change-Id: Ic51745103446dda8ea8ff901c4f211c30c39e45c
2014-06-10 17:34:52 +00:00
Niklas Laxström 4c0221c09c Remove useless isset
The exact same thing is access two lines above without isset

Change-Id: I242b9f402908c7d40c0dc026c6c5d99ac1e2bf4a
2014-04-17 08:17:16 +00:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08: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
Ed Sanders 78ec5e84d9 Set 'notminor' if minor edit box not checked
In order to properly override the minor-edit-by-default setting
if it is used.

Bug: 51515
Change-Id: Ic49d47971a795c7efd860a962cfe13b89d2bb95a
2013-07-24 15:07:05 +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