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

Change subject: Fix JS error in MT tool: MTControlCard.providers undefined
......................................................................


Fix JS error in MT tool: MTControlCard.providers undefined

This issue happens when cxserver/v1/list/mt/source/target returns
{} as a result (no pairs available).

The MT card won't be shown in such cases becaus of JS error.

Bug: T130357
Change-Id: I088cd299758651e3972a25e8feaaa61dadd18713
(cherry picked from commit 62332fef167ed492dee58f3f60109f4a4f376570)
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 5 insertions(+), 2 deletions(-)

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



diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 098a52c..bca4ef6 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -433,7 +433,8 @@
        };
 
        MTControlCard.prototype.buildProvidersMenu = function () {
-               var provider, items, nonDefaultMT, newProvider = false;
+               var provider, items = [],
+                       nonDefaultMT, newProvider = false;
 
                if ( MTControlCard.providers && MTControlCard.providers.length 
> 1 ) {
                        nonDefaultMT = true;
@@ -450,7 +451,9 @@
                        .addClass( 'card__providers-menu' )
                        .hide();
 
-               items = MTControlCard.providers.slice( 0 ); // Copy values.
+               if ( MTControlCard.providers ) {
+                       items = MTControlCard.providers.slice( 0 ); // Copy 
values.
+               }
                if ( items.indexOf( sourceMT ) < 0 ) {
                        items.push( sourceMT );
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I088cd299758651e3972a25e8feaaa61dadd18713
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: wmf/1.27.0-wmf.17
Gerrit-Owner: KartikMistry <kartik.mis...@gmail.com>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: Thcipriani <tcipri...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to