Nikerabbit has uploaded a new change for review.

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

Change subject: Do not allow empty html when saving or publishing
......................................................................

Do not allow empty html when saving or publishing

This can cause loss of previous translations, if previous content
is replaced with empty string, possibly caused by JavaScript error.

Also no point creating new, empty drafts.

Change-Id: Id51618611e7eb120e2ab4c64c43241a85d0a46e2
---
M api/ApiContentTranslationPublish.php
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index c776152..70a8367 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -155,6 +155,10 @@
                        $this->dieUsage( 'Invalid target language', 
'invalidtargetlanguage' );
                }
 
+               if ( trim( $params['html'] ) === '' ) {
+                       $this->dieUsage( 'html cannot be empty', 'invalidhtml' 
);
+               }
+
                if ( $params['status'] === 'draft' ) {
                        $this->saveAsDraft();
                } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id51618611e7eb120e2ab4c64c43241a85d0a46e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

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

Reply via email to