Mwalker has uploaded a new change for review.

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


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, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/06/92806/1

diff --git a/CentralNotice.hooks.php b/CentralNotice.hooks.php
index bfbd034..74c619f 100644
--- a/CentralNotice.hooks.php
+++ b/CentralNotice.hooks.php
@@ -299,10 +299,28 @@
                $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 );
+               }
+       }
+
        $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: newchange
Gerrit-Change-Id: I5d5b032b7a073ef5ee0fbb7356c91625e0da9f41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>

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

Reply via email to