From: Ori.livneh Date: Wed, 17 Jun 2015 19:51:49 +0000 (+0000) Subject: Revert "StashEdit: Use postWithToken" X-Git-Tag: 1.31.0-rc.0~11051^2 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=66d568958317bcc99321989398cb8d698d6479a0;p=lhc%2Fweb%2Fwiklou.git Revert "StashEdit: Use postWithToken" This reverts commit 155ad712c3. Bug: T102863 Change-Id: Ia30b535a44a3aa4d6e79f14bbccb6f4a1b065aa2 --- diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.stash.js b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js index 8e7b168cbd..29c533d89a 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.stash.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js @@ -11,6 +11,22 @@ data = {}, timer = null; + function stashEdit( token ) { + data = $form.serializeObject(); + + pending = api.post( { + action: 'stashedit', + token: token, + title: mw.config.get( 'wgPageName' ), + section: data.wpSection, + sectiontitle: '', + text: data.wpTextbox1, + contentmodel: data.model, + contentformat: data.format, + baserevid: data.parentRevId + } ); + } + /* Has the edit body text changed since the last stashEdit() call? */ function isChanged() { // Normalize line endings to CRLF, like $.fn.serializeObject does. @@ -28,17 +44,7 @@ pending.abort(); } - data = $form.serializeObject(); - pending = api.postWithToken( 'edit', { - action: 'stashedit', - title: mw.config.get( 'wgPageName' ), - section: data.wpSection, - sectiontitle: '', - text: data.wpTextbox1, - contentmodel: data.model, - contentformat: data.format, - baserevid: data.parentRevId - } ); + api.getToken( 'edit' ).then( stashEdit ); } function onKeyPress( e ) {