jenkins-bot has submitted this change and it was merged.

Change subject: Draft: Avoid saving when content is not present
......................................................................


Draft: Avoid saving when content is not present

Noticed this happening when qunit tests are executed.

Change-Id: I3c0614ca01692f49ceec46738d3b5de1c4e2fc54
---
M modules/translation/ext.cx.translation.draft.js
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/translation/ext.cx.translation.draft.js 
b/modules/translation/ext.cx.translation.draft.js
index 9f6800b..554b7e2 100644
--- a/modules/translation/ext.cx.translation.draft.js
+++ b/modules/translation/ext.cx.translation.draft.js
@@ -354,8 +354,10 @@
         */
        ContentTranslationDraft.prototype.save = function () {
                var targetTitle, params, apiParams, now,
+                       content,
                        api = new mw.Api();
 
+               content = this.getContent();
                if ( this.disabled ) {
                        return;
                }
@@ -366,13 +368,12 @@
                        to: mw.cx.targetLanguage,
                        sourcetitle: mw.cx.sourceTitle,
                        title: targetTitle,
-                       html: EasyDeflate.deflate( this.getContent() ),
                        status: 'draft',
                        sourcerevision: mw.cx.sourceRevision,
                        progress: JSON.stringify( mw.cx.getProgress() )
                };
 
-               if ( !params.html ) {
+               if ( !content ) {
                        // There's no content to save,
                        // but don't let the save initiator wait infinitely
                        mw.hook( 'mw.cx.translation.saved' ).fire(
@@ -383,6 +384,8 @@
                        );
 
                        return;
+               } else {
+                       params.html = EasyDeflate.deflate( content );
                }
 
                now = Date.now();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3c0614ca01692f49ceec46738d3b5de1c4e2fc54
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to