Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/259232

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, 4 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/32/259232/1

diff --git a/modules/translation/ext.cx.translation.draft.js 
b/modules/translation/ext.cx.translation.draft.js
index 9f6800b..24e28e5 100644
--- a/modules/translation/ext.cx.translation.draft.js
+++ b/modules/translation/ext.cx.translation.draft.js
@@ -354,9 +354,11 @@
         */
        ContentTranslationDraft.prototype.save = function () {
                var targetTitle, params, apiParams, now,
+                       content,
                        api = new mw.Api();
 
-               if ( this.disabled ) {
+               content = this.getContent();
+               if ( this.disabled || !content ) {
                        return;
                }
                targetTitle = $( '.cx-column--translation > h2' ).text();
@@ -366,7 +368,7 @@
                        to: mw.cx.targetLanguage,
                        sourcetitle: mw.cx.sourceTitle,
                        title: targetTitle,
-                       html: EasyDeflate.deflate( this.getContent() ),
+                       html: EasyDeflate.deflate( content ),
                        status: 'draft',
                        sourcerevision: mw.cx.sourceRevision,
                        progress: JSON.stringify( mw.cx.getProgress() )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c0614ca01692f49ceec46738d3b5de1c4e2fc54
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to