Live location sharing - open location in OpenStreetMap (PSF-1040) (#8695)

* share plain lat,lon string from beacon tooltip and list item

Signed-off-by: Kerry Archibald <kerrya@element.io>

* export makeMapSiteLink helper fn

Signed-off-by: Kerry Archibald <kerrya@element.io>

* use currentColor in external-link.svg

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add open in openstreetmap link

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fussy import ordering

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix icon color var

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-05-27 11:58:39 +02:00 committed by GitHub
parent 12abbf4042
commit 15c2fb6b71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 254 additions and 31 deletions

View file

@ -14,20 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { createMapSiteLink } from "../../../src/utils/location";
import { createMapSiteLinkFromEvent } from "../../../src/utils/location";
import { mkMessage } from "../../test-utils";
import { makeLegacyLocationEvent, makeLocationEvent } from "../../test-utils/location";
describe("createMapSiteLink", () => {
describe("createMapSiteLinkFromEvent", () => {
it("returns null if event does not contain geouri", () => {
expect(createMapSiteLink(mkMessage({
expect(createMapSiteLinkFromEvent(mkMessage({
room: '1', user: '@sender:server', event: true,
}))).toBeNull();
});
it("returns OpenStreetMap link if event contains m.location", () => {
expect(
createMapSiteLink(makeLocationEvent("geo:51.5076,-0.1276")),
createMapSiteLinkFromEvent(makeLocationEvent("geo:51.5076,-0.1276")),
).toEqual(
"https://www.openstreetmap.org/" +
"?mlat=51.5076&mlon=-0.1276" +
@ -37,7 +37,7 @@ describe("createMapSiteLink", () => {
it("returns OpenStreetMap link if event contains geo_uri", () => {
expect(
createMapSiteLink(makeLegacyLocationEvent("geo:51.5076,-0.1276")),
createMapSiteLinkFromEvent(makeLegacyLocationEvent("geo:51.5076,-0.1276")),
).toEqual(
"https://www.openstreetmap.org/" +
"?mlat=51.5076&mlon=-0.1276" +