Siebrand has uploaded a new change for review.

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


Change subject: Allow always using https links in emails
......................................................................

Allow always using https links in emails

To enable this feature, $wgTranslationNotificationsAlwaysHttpsInEmail has
to be set to true.

Bug: 39139
Change-Id: I42ae891cd23653bf30dc78f872b4d4b87a935aed
---
M SpecialNotifyTranslators.php
M TranslationNotifications.php
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslationNotifications 
refs/changes/49/84849/1

diff --git a/SpecialNotifyTranslators.php b/SpecialNotifyTranslators.php
index d59290e..3ea8434 100644
--- a/SpecialNotifyTranslators.php
+++ b/SpecialNotifyTranslators.php
@@ -508,17 +508,29 @@
        protected function sendTranslationNotificationEmail( User $user,
                $languagesToNotify = array()
        ) {
+               global $wgTranslationNotificationsAlwaysHttpsInEmail;
+
                $relevantLanguages = $this->getRelevantLanguages( $user, 
$languagesToNotify );
                $userFirstLanguage = Language::factory( 
$this->getUserFirstLanguage( $user ) );
 
                $emailSubject = self::getNotificationSubject( 
$userFirstLanguage );
                $signupURL = SpecialPage::getTitleFor( 'TranslatorSignup' 
)->getCanonicalUrl();
+               $translationUrls = $this->getTranslationURLs(
+                       $relevantLanguages,
+                       'email',
+                       $userFirstLanguage
+               );
+
+               if ( $wgTranslationNotificationsAlwaysHttpsInEmail === true ) {
+                       $translationUrls = str_replace( 'http:', 'https:', 
$translationUrls );
+               }
+
                $emailBody = $this->msg(
                        'translationnotifications-email-body',
                        $this->getUserName( $user ),
                        $userFirstLanguage->listToText( array_values( 
$relevantLanguages ) ),
                        $this->translatablePageTitle,
-                       $this->getTranslationURLs( $relevantLanguages, 'email', 
$userFirstLanguage ),
+                       $translationUrls,
                        $this->getPriorityClause( $userFirstLanguage ),
                        $this->getDeadlineClause( $userFirstLanguage ),
                        $this->notificationText,
diff --git a/TranslationNotifications.php b/TranslationNotifications.php
index a4f57ed..791a9b4 100644
--- a/TranslationNotifications.php
+++ b/TranslationNotifications.php
@@ -89,6 +89,9 @@
 // Message key of the legal text for Special:TranslatorSignup page.
 $wgTranslationNotificationsSignupLegalMessage = 
'translationnotifications-signup-legal';
 
+// Always use https links for translation notification emails?
+$wgTranslationNotificationsAlwaysHttpsInEmail = false;
+
 // Give the language options default empty values, so that they
 // won't be saved as empty strings. (Bug 37165)
 foreach ( range( 1, 3 ) as $langNum ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42ae891cd23653bf30dc78f872b4d4b87a935aed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Siebrand <siebr...@wikimedia.org>

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

Reply via email to