jenkins-bot has submitted this change and it was merged.
Change subject: Allow configuration of range in Special:Nearby
......................................................................
Allow configuration of range in Special:Nearby
Allows projects like Wikivoyage to redefine what 'nearby' means
(see bug 49288)
Change-Id: I4c0a5f894f6394dc2d1f853ee9eba75fce8c6bf6
---
M MobileFrontend.php
M includes/specials/SpecialNearby.php
M javascripts/specials/nearby.js
3 files changed, 12 insertions(+), 1 deletion(-)
Approvals:
awjrichards: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 18db9c4..2859cd4 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -299,6 +299,11 @@
$wgMFNearby = false;
/**
+ * The range in meters that should be searched to find nearby pages on
Special:Nearby (defaults to 10km)
+ */
+$wgMFNearbyRange = 10000;
+
+/**
* Whether the login form should redirect to another URL on the first login
attempt.
*
* Defaults to false.
diff --git a/includes/specials/SpecialNearby.php
b/includes/specials/SpecialNearby.php
index b13e740..61fcecc 100644
--- a/includes/specials/SpecialNearby.php
+++ b/includes/specials/SpecialNearby.php
@@ -6,9 +6,15 @@
}
public function execute( $par = '' ) {
+ global $wgMFNearbyRange;
+
$this->setHeaders();
$output = $this->getOutput();
+
+ // set config
+ $output->addJsConfigVars( 'wgMFNearbyRange', $wgMFNearbyRange );
+
// add previews to mobile only
$ctx = MobileContext::singleton();
if ( $ctx->shouldDisplayMobileView() &&
$ctx->isBetaGroupMember() ) {
diff --git a/javascripts/specials/nearby.js b/javascripts/specials/nearby.js
index a6cd810..ba32295 100644
--- a/javascripts/specials/nearby.js
+++ b/javascripts/specials/nearby.js
@@ -151,7 +151,7 @@
}
function findResults( lat, lng ) {
- var $content = $( '#mw-mf-nearby' ), range = 10000,
+ var $content = $( '#mw-mf-nearby' ), range = mw.config.get(
'wgMFNearbyRange' ),
limit = 50;
$.ajax( {
--
To view, visit https://gerrit.wikimedia.org/r/67877
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4c0a5f894f6394dc2d1f853ee9eba75fce8c6bf6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits