mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Live location sharing: remove geoUri logs (#8465)
* remove geoUri logs Signed-off-by: Kerry Archibald <kerrya@element.io> * Update src/components/views/location/Map.tsx Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
f280fab47d
commit
3b1e715854
2 changed files with 6 additions and 6 deletions
|
@ -51,8 +51,8 @@ const useMapWithStyle = ({ id, centerGeoUri, onError, interactive, bounds }) =>
|
||||||
try {
|
try {
|
||||||
const coords = parseGeoUri(centerGeoUri);
|
const coords = parseGeoUri(centerGeoUri);
|
||||||
map.setCenter({ lon: coords.longitude, lat: coords.latitude });
|
map.setCenter({ lon: coords.longitude, lat: coords.latitude });
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
logger.error('Could not set map center', centerGeoUri);
|
logger.error('Could not set map center');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [map, centerGeoUri]);
|
}, [map, centerGeoUri]);
|
||||||
|
@ -65,8 +65,8 @@ const useMapWithStyle = ({ id, centerGeoUri, onError, interactive, bounds }) =>
|
||||||
[bounds.east, bounds.north],
|
[bounds.east, bounds.north],
|
||||||
);
|
);
|
||||||
map.fitBounds(lngLatBounds, { padding: 100, maxZoom: 15 });
|
map.fitBounds(lngLatBounds, { padding: 100, maxZoom: 15 });
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
logger.error('Invalid map bounds', error);
|
logger.error('Invalid map bounds');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [map, bounds]);
|
}, [map, bounds]);
|
||||||
|
|
|
@ -101,7 +101,7 @@ describe('<Map />', () => {
|
||||||
const logSpy = jest.spyOn(logger, 'error').mockImplementation();
|
const logSpy = jest.spyOn(logger, 'error').mockImplementation();
|
||||||
getComponent({ centerGeoUri: '123 Sesame Street' });
|
getComponent({ centerGeoUri: '123 Sesame Street' });
|
||||||
expect(mockMap.setCenter).not.toHaveBeenCalled();
|
expect(mockMap.setCenter).not.toHaveBeenCalled();
|
||||||
expect(logSpy).toHaveBeenCalledWith('Could not set map center', '123 Sesame Street');
|
expect(logSpy).toHaveBeenCalledWith('Could not set map center');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('updates map center when centerGeoUri prop changes', () => {
|
it('updates map center when centerGeoUri prop changes', () => {
|
||||||
|
@ -133,7 +133,7 @@ describe('<Map />', () => {
|
||||||
const bounds = { north: 'a', south: 'b', east: 42, west: 41 };
|
const bounds = { north: 'a', south: 'b', east: 42, west: 41 };
|
||||||
getComponent({ bounds });
|
getComponent({ bounds });
|
||||||
expect(mockMap.fitBounds).not.toHaveBeenCalled();
|
expect(mockMap.fitBounds).not.toHaveBeenCalled();
|
||||||
expect(logSpy).toHaveBeenCalledWith('Invalid map bounds', new Error('Invalid LngLat object: (41, NaN)'));
|
expect(logSpy).toHaveBeenCalledWith('Invalid map bounds');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('updates map bounds when bounds prop changes', () => {
|
it('updates map bounds when bounds prop changes', () => {
|
||||||
|
|
Loading…
Reference in a new issue