Santhosh has uploaded a new change for review.

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

Change subject: Source and target languages should not fallback to user or 
content language
......................................................................

Source and target languages should not fallback to user or content language

They must come from URL. If not passed redirect to dashboard

Change-Id: Iebce557ec4b905296fc6fdff19d7f1eae06356f1
---
M modules/source/ext.cx.source.js
1 file changed, 7 insertions(+), 5 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index 52379c2..305df83 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -29,16 +29,18 @@
 
        ContentTranslationSource.prototype.init = function () {
                mw.cx.sourceTitle = new mw.Uri().query.page;
+               mw.cx.targetLanguage = new mw.Uri().query.to;
+               mw.cx.sourceLanguage = new mw.Uri().query.from;
+
                if ( mw.user.isAnon() ) {
                        mw.hook( 'mw.cx.error.anonuser' ).fire();
                        return;
                }
-               if ( !mw.cx.sourceTitle ) {
+               if ( !mw.cx.sourceTitle || !mw.cx.sourceLanguage || 
!mw.cx.targetLanguage ) {
                        this.showDashboard();
                        return;
                }
-               mw.cx.targetLanguage = new mw.Uri().query.to || mw.config.get( 
'wgUserLanguage' );
-               mw.cx.sourceLanguage = new mw.Uri().query.from || 
mw.config.get( 'wgContentLanguage' );
+
                this.render();
                this.fetchPage( mw.cx.sourceTitle, mw.cx.sourceLanguage );
                this.listen();
@@ -116,7 +118,7 @@
                                        target: '_blank'
                                } )
                                .text( mw.msg( 'cx-source-view-page' ) )
-               );
+                       );
 
                $subHeading = $( '<div>' )
                        .addClass( 'cx-column__sub-heading' )
@@ -152,7 +154,7 @@
                                $( '<div>' ).addClass( 'bounce1' ),
                                $( '<div>' ).addClass( 'bounce2' ),
                                $( '<div>' ).addClass( 'bounce3' )
-               );
+                       );
 
                $loadingIndicator.append( $loadingIndicatorSpinner, 
$loadingIndicatorText );
                this.$content.append( $loadingIndicator );

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

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

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

Reply via email to