Skip to content
Snippets Groups Projects
Commit c0fa2e5e authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #4052 from tgxn/develop

Handle shared locations better when new shares are disabled
parents b14f2b21 223742b1
Loading
......@@ -1030,6 +1030,7 @@
"Settings" : "Settings",
"Settings_updated" : "Settings updated",
"Share_Location_Title" : "Share Location?",
"Shared_Location" : "Shared Location",
"Should_be_a_URL_of_an_image" : "Should be a URL of an image.",
"Should_exists_a_user_with_this_username" : "The user must already exist.",
"Show_all" : "Show all",
......
......@@ -7,10 +7,9 @@ class MapView
constructor: (message) ->
# get MapView settings
mv_enabled = RocketChat.settings.get 'MapView_Enabled'
mv_googlekey = RocketChat.settings.get 'MapView_GMapsAPIKey'
if message.location and mv_enabled
if message.location
# GeoJSON is reversed - ie. [lng, lat]
longitude = message.location.coordinates[0]
......@@ -19,6 +18,8 @@ class MapView
# confirm we have an api key set, and generate the html required for the mapview
if 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>'
else
message.html = '<a href="https://maps.google.com/maps?daddr='+latitude+','+longitude+'" target="_blank">'+TAPi18n.__('Shared_Location')+'</a>'
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