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

Change subject: Serve Mobile URLs to Mobile Users
......................................................................


Serve Mobile URLs to Mobile Users

When on the mobile site serve CentralNotice infrastructure URLs
as mobile varients.

Always serve mobile variants of hide cookie endpoints.

Bug: 55860
Change-Id: I5d5b032b7a073ef5ee0fbb7356c91625e0da9f41
---
M CentralNotice.hooks.php
1 file changed, 19 insertions(+), 0 deletions(-)

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



diff --git a/CentralNotice.hooks.php b/CentralNotice.hooks.php
index bfbd034..7722bff 100644
--- a/CentralNotice.hooks.php
+++ b/CentralNotice.hooks.php
@@ -299,10 +299,29 @@
                $wgCentralBannerRecorder = 
"{$wgScript}/{$wgContLang->specialPage( 'RecordImpression' )}";
        }
 
+       // Mangle infrastructure URLs for mobile use -- this should always be 
last.
+       if ( class_exists( 'MobileContext' ) ) {
+               // Where possible; make things mobile friendly
+               $mc = MobileContext::singleton();
+               if ( $mc->shouldDisplayMobileView() ) {
+                       $wgNoticeFundraisingUrl = $mc->getMobileUrl( 
$wgNoticeFundraisingUrl );
+                       $wgCentralPagePath = $mc->getMobileUrl( 
$wgCentralPagePath );
+                       $wgCentralBannerDispatcher = $mc->getMobileUrl( 
$wgCentralBannerDispatcher );
+                       $wgCentralBannerRecorder = $mc->getMobileUrl( 
$wgCentralBannerRecorder );
+               }
+
+               $mobileHides = array();
+               foreach( $wgNoticeHideUrls as $url ) {
+                       $mobileHides[] = $mc->getMobileUrl( $url );
+               }
+               $wgNoticeHideUrls = array_merge( $wgNoticeHideUrls, 
$mobileHides );
+       }
+
        $vars[ 'wgNoticeFundraisingUrl' ] = $wgNoticeFundraisingUrl;
        $vars[ 'wgCentralPagePath' ] = $wgCentralPagePath;
        $vars[ 'wgCentralBannerDispatcher' ] = $wgCentralBannerDispatcher;
        $vars[ 'wgCentralBannerRecorder' ] = $wgCentralBannerRecorder;
+
        $vars[ 'wgNoticeXXCountries' ] = $wgNoticeXXCountries;
        $vars[ 'wgNoticeNumberOfBuckets' ] = $wgNoticeNumberOfBuckets;
        $vars[ 'wgNoticeBucketExpiry' ] = $wgNoticeBucketExpiry;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5d5b032b7a073ef5ee0fbb7356c91625e0da9f41
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>
Gerrit-Reviewer: Adamw <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to