Ori.livneh has submitted this change and it was merged.

Change subject: Don't attempt to stash new section edits
......................................................................


Don't attempt to stash new section edits

The parser output of edits produced via the 'new section' interface varies on
both the edit body and the edit summary (since it determines the new section's
name). So there isn't an early point in the edit process where we can start
computing the edit output. We have to wait for the user to be completely
done, by which point edit-stashing provides no advantage.

Change-Id: Ida461e08189b75c5a508628d11dc929a6138814a
(cherry picked from commit c4f67e5a3a8c3286487ad10b575730c9b0204b0a)
---
M resources/src/mediawiki.action/mediawiki.action.edit.stash.js
1 file changed, 14 insertions(+), 3 deletions(-)

Approvals:
  Ori.livneh: Verified; Looks good to me, approved



diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.stash.js 
b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js
index 895cb03..9972321 100644
--- a/resources/src/mediawiki.action/mediawiki.action.edit.stash.js
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js
@@ -13,7 +13,7 @@
                                token: token,
                                title: mw.config.get( 'wgPageName' ),
                                section: data.wpSection,
-                               sectiontitle: data.wpSection === 'new' ? 
data.wpSummary : '',
+                               sectiontitle: '',
                                text: data.wpTextbox1,
                                contentmodel: data.model,
                                contentformat: data.format,
@@ -21,11 +21,22 @@
                        } );
                }
 
-               $form.on( 'change', function () {
+               function onEditChanged() {
+                       // If a stash request is already in flight, abort it, 
since its
+                       // payload has just been invalidated by this change.
                        if ( pending ) {
                                pending.abort();
                        }
                        api.getToken( 'edit' ).then( stashEdit );
-               } );
+               }
+
+               // We don't attempt to stash new section edits because in such 
cases
+               // the parser output varies on the edit summary (since it 
determines
+               // the new section's name).
+               if ( $form.find( 'input[name=wpSection]' ).val() === 'new' ) {
+                       return;
+               }
+
+               $form.find( '#wpTextbox1' ).on( 'change', onEditChanged );
        } );
 }( mediaWiki, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/178247
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ida461e08189b75c5a508628d11dc929a6138814a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.25wmf11
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to