From 66d568958317bcc99321989398cb8d698d6479a0 Mon Sep 17 00:00:00 2001 From: "Ori.livneh" Date: Wed, 17 Jun 2015 19:51:49 +0000 Subject: [PATCH] Revert "StashEdit: Use postWithToken" This reverts commit 155ad712c3. Bug: T102863 Change-Id: Ia30b535a44a3aa4d6e79f14bbccb6f4a1b065aa2 --- .../mediawiki.action.edit.stash.js | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) 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 ) { -- 2.20.1