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

Change subject: Avoid unstubbing wgUser when an external survey is defined
......................................................................


Avoid unstubbing wgUser when an external survey is defined

Use content language to load the survey URL so that the user is
not loaded. This will break l10n of the survey URL (if that was
the intention) but retain wiki admins' ability to change it per-site.
If localization is needed, it should be reintroduced in a way
that is consistent with the ResourceLoader contract (no user-
dependency outside MakeGlobalVariablesScript).

Also fix the logic which would have considered protocol-relative
URLs insecure but any URL with 'https' anywhere in it secure.

Bug: T127870
Change-Id: Id1956d139a2c06d1e33d8a6d62d92b815a54a8fe
---
M includes/ExternalSurvey.php
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  BryanDavis: Looks good to me, approved
  Krinkle: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/ExternalSurvey.php b/includes/ExternalSurvey.php
index cea52a5..2edcb3d 100644
--- a/includes/ExternalSurvey.php
+++ b/includes/ExternalSurvey.php
@@ -14,7 +14,7 @@
        private $name;
 
        /**
-        * @var string The URL of the external survey.
+        * @var string The key of the message containing the URL of the 
external survey.
         */
        private $link;
 
@@ -45,7 +45,8 @@
                $this->link = $link;
                $this->instanceTokenParameterName = $instanceTokenParameterName;
                $this->privacyPolicy = $privacyPolicy;
-               $this->isInsecure = !preg_match( '/https/i', wfMessage( 
$this->link )->plain() ) ? true : false;
+               $url = wfMessage( $this->link )->inContentLanguage()->plain();
+               $this->isInsecure = strpos( $url, 'http:' ) === 0;
        }
 
        public function getMessages() {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id1956d139a2c06d1e33d8a6d62d92b815a54a8fe
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Jhobs <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to