Skip to content

Commit

Permalink
Merge pull request #13496 from RocketChat/regression/geolocation
Browse files Browse the repository at this point in the history
Regression: Message box geolocation was throwing error
  • Loading branch information
MarcosSpessatto authored Feb 15, 2019
2 parents 1a46bb0 + 0e6ff28 commit 8a2d7e5
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { messageBox, modal } from 'meteor/rocketchat:ui-utils';
import { fileUpload } from 'meteor/rocketchat:ui';
import { settings } from 'meteor/rocketchat:settings';
import { t } from 'meteor/rocketchat:utils';
import { geolocation } from '../messageBox';

messageBox.actions.add('Create_new', 'Video_message', {
id: 'video-message',
Expand Down Expand Up @@ -63,6 +62,8 @@ messageBox.actions.add('Add_files_from', 'Computer', {
},
});

const geolocation = new ReactiveVar(false);

messageBox.actions.add('Share', 'My_location', {
id: 'share-location',
icon: 'map-pin',
Expand Down Expand Up @@ -97,10 +98,8 @@ messageBox.actions.add('Share', 'My_location', {
});

Meteor.startup(() => {
RocketChat.Geolocation = new ReactiveVar(false);

const handleGeolocation = (position) => RocketChat.Geolocation.set(position);
const handleGeolocationError = () => RocketChat.Geolocation.set(false);
const handleGeolocation = (position) => geolocation.set(position);
const handleGeolocationError = () => geolocation.set(false);

Tracker.autorun(() => {
const isMapViewEnabled = RocketChat.settings.get('MapView_Enabled') === true;
Expand All @@ -110,7 +109,7 @@ Meteor.startup(() => {
isMapViewEnabled && isGeolocationWatchSupported && (googleMapsApiKey && googleMapsApiKey.length);

if (!canGetGeolocation) {
RocketChat.Geolocation.set(false);
geolocation.set(false);
return;
}

Expand Down

0 comments on commit 8a2d7e5

Please sign in to comment.