Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Message box geolocation was throwing error #13496

Merged
merged 2 commits into from Feb 15, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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