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

Change subject: Fix the wrong domain name for translation token if domain is 
localhost
......................................................................


Fix the wrong domain name for translation token if domain is localhost

Bug: T86292
Change-Id: I7c253b74f35b83dee32bec900cf67afcb0b3e82e
---
M modules/source/ext.cx.source.selector.js
1 file changed, 5 insertions(+), 3 deletions(-)

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



diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index 9e24c7a..1d86ed5 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -762,16 +762,18 @@
         * @param {string} sourceTitle Source title
         */
        function setCXToken( sourceLanguage, targetLanguage, sourceTitle ) {
-               var slug, now, name, options;
+               var slug, now, name, options, domain;
 
                now = new Date();
                slug = sourceTitle.replace( /\s/g, '-' );
                name = [ 'cx', slug, sourceLanguage, targetLanguage ].join( '_' 
);
-
+               domain = location.hostname.indexOf( '.' ) > 0 ?
+                       '.' + location.hostname.split( '.' ).splice( 1 ).join( 
'.' ) :
+                       null; // Mostly domains like "localhost"
                options = {
                        prefix: '',
                        // Use Domain cookie. Example: domain=.wikipedia.org
-                       domain: '.' + location.hostname.split( '.' ).splice( 1 
).join( '.' ),
+                       domain: domain,
                        expires: new Date( now.getTime() + ( 5 * 60 * 1000 ) ) 
// 5 mins from now.
                };
 

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

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

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

Reply via email to