Amire80 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/182411
Change subject: Cleanup whitespace in CXSourceSelector.prototype.check
......................................................................
Cleanup whitespace in CXSourceSelector.prototype.check
Make deeply nested callbacks more readable.
Change-Id: I70789ac04e97c83a561245102bdc710fceb53ab3
---
M modules/source/ext.cx.source.selector.js
1 file changed, 37 insertions(+), 31 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/11/182411/1
diff --git a/modules/source/ext.cx.source.selector.js
b/modules/source/ext.cx.source.selector.js
index 903d0e9..a601b03 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -404,38 +404,44 @@
if ( !sourcePage ) {
selector.$translateFromButton.prop( 'disabled',
true );
selector.showSourceTitleError( sourceLanguage );
- } else {
- selector.$translateFromButton.prop( 'disabled',
false );
- // Check to see if there is a matching article
in the target wiki.
- // The matching article may or may not have the
same title.
- selector.checkForEquivalentTargetPage(
- sourceLanguage,
- targetLanguage,
- sourceTitle
- )
- .done( function ( equivalentTargetPage
) {
- // Check to see if the
specified target title is in use.
- // Must be nested inside check
for matching target article
- // because first possible error
requires results of both API calls.
- selector.checkForTitle(
targetLanguage, targetTitle )
- .done( function (
existingTargetTitle ) {
- // If there is
a matching target page and
- // the
specified target title is in use
- if (
equivalentTargetPage && existingTargetTitle ) {
-
selector.showPageExistsAndTitleInUseError(
-
equivalentTargetPage,
-
existingTargetTitle
- );
- // If
there is just a matching target page
- } else if (
equivalentTargetPage ) {
-
selector.showPageExistsError( equivalentTargetPage );
- // If
the specified target title is in use
- } else if (
existingTargetTitle ) {
-
selector.showTitleInUseError( existingTargetTitle );
- }
- } );
- } );
+
+ return;
}
+
+ selector.$translateFromButton.prop( 'disabled', false );
+
+ // Check to see if there is a matching article in the
target wiki.
+ // The matching article may or may not have the same
title.
+ selector.checkForEquivalentTargetPage(
+ sourceLanguage,
+ targetLanguage,
+ sourceTitle
+ ).done( function ( equivalentTargetPage ) {
+ // Check to see if the specified target title
is in use.
+ // Must be nested inside check for matching
target article
+ // because first possible error requires
results of both API calls.
+ selector.checkForTitle(
+ targetLanguage,
+ targetTitle
+ ).done( function ( existingTargetTitle ) {
+ // If there is a matching target page
and
+ // the specified target title is in use
+ if ( equivalentTargetPage &&
existingTargetTitle ) {
+
selector.showPageExistsAndTitleInUseError(
+ equivalentTargetPage,
+ existingTargetTitle
+ );
+
+ // If there is just a matching target
page
+ } else if ( equivalentTargetPage ) {
+ selector.showPageExistsError(
equivalentTargetPage );
+
+ // If the specified target title is in
use
+ } else if ( existingTargetTitle ) {
+ selector.showTitleInUseError(
existingTargetTitle );
+ }
+ } );
+ } );
} );
};
--
To view, visit https://gerrit.wikimedia.org/r/182411
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I70789ac04e97c83a561245102bdc710fceb53ab3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits