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

Change subject: Unbreak token fetching for anonymous users
......................................................................


Unbreak token fetching for anonymous users

Current code was not checking the value of $wgMFAnonymousEditing

Bug: 56831
Change-Id: Ibbe6cf7f3e8ee892beea11abfa33858fa2c3e393
---
M javascripts/common/api.js
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/javascripts/common/api.js b/javascripts/common/api.js
index 83119f6..6c9e8c6 100644
--- a/javascripts/common/api.js
+++ b/javascripts/common/api.js
@@ -139,7 +139,7 @@
                        if ( !this.tokenCache[ endpoint ] ) {
                                this.tokenCache[ endpoint ] = {};
                        }
-                       if ( !M.isLoggedIn() ) {
+                       if ( !M.isLoggedIn() && !mw.config.get( 
'wgMFAnonymousEditing' ) ) {
                                return d.reject( 'Token requested when not 
logged in.' );
                        } else if ( isCacheable && this.tokenCache[ endpoint 
].hasOwnProperty( tokenType ) ) {
                                return this.tokenCache[ endpoint ][ tokenType ];
@@ -161,7 +161,7 @@
                                        var token;
                                        if ( tokenData && tokenData.tokens && 
!tokenData.warnings ) {
                                                token = tokenData.tokens[ 
tokenType + 'token' ];
-                                               if ( token && token !== '+\\' ) 
{
+                                               if ( token && ( token !== '+\\' 
|| mw.config.get( 'wgMFAnonymousEditing' ) ) ) {
                                                        d.resolve( token );
                                                } else {
                                                        d.reject( 'Anonymous 
token.' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibbe6cf7f3e8ee892beea11abfa33858fa2c3e393
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Jdlrobson <jrob...@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