Skip to content
Snippets Groups Projects
Commit 453cc192 authored by Domenic Horner's avatar Domenic Horner
Browse files

handle locations when disabled

parent f89099a2
No related merge requests found
...@@ -10,15 +10,17 @@ class MapView ...@@ -10,15 +10,17 @@ class MapView
mv_enabled = RocketChat.settings.get 'MapView_Enabled' mv_enabled = RocketChat.settings.get 'MapView_Enabled'
mv_googlekey = RocketChat.settings.get 'MapView_GMapsAPIKey' mv_googlekey = RocketChat.settings.get 'MapView_GMapsAPIKey'
if message.location and mv_enabled if message.location
# GeoJSON is reversed - ie. [lng, lat] # GeoJSON is reversed - ie. [lng, lat]
longitude = message.location.coordinates[0] longitude = message.location.coordinates[0]
latitude = message.location.coordinates[1] latitude = message.location.coordinates[1]
# confirm we have an api key set, and generate the html required for the mapview # confirm we have an api key set, and generate the html required for the mapview
if mv_googlekey?.length if mv_enabled and mv_googlekey?.length
message.html = '<a href="https://maps.google.com/maps?daddr='+latitude+','+longitude+'" target="_blank"><img src="https://maps.googleapis.com/maps/api/staticmap?zoom=14&size=250x250&markers=color:gray%7Clabel:%7C'+latitude+','+longitude+'&key='+mv_googlekey+'" /></a>' message.html = '<a href="https://maps.google.com/maps?daddr='+latitude+','+longitude+'" target="_blank"><img src="https://maps.googleapis.com/maps/api/staticmap?zoom=14&size=250x250&markers=color:gray%7Clabel:%7C'+latitude+','+longitude+'&key='+mv_googlekey+'" /></a>'
else
message.html = '<a href="https://maps.google.com/maps?daddr='+latitude+','+longitude+'" target="_blank">Shared Location</a>'
return message return message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment