Live location share - forward latest location (PSF-1044) (#8860)
* handle beacon location events in ForwardDialog * add transformer for forwarded events in MessageContextMenu * remove canForward * update snapshots for beacon model change * add comments * fix bad copy pasted test * add test for beacon locations
This commit is contained in:
parent
0a90674e89
commit
b51ef246ab
12 changed files with 292 additions and 81 deletions
|
@ -28,6 +28,7 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
|||
import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks";
|
||||
import {
|
||||
getMockClientWithEventEmitter,
|
||||
makeBeaconEvent,
|
||||
makeLegacyLocationEvent,
|
||||
makeLocationEvent,
|
||||
mkEvent,
|
||||
|
@ -285,6 +286,33 @@ describe("ForwardDialog", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('forwards beacon location as a pin drop event', async () => {
|
||||
const timestamp = 123456;
|
||||
const beaconEvent = makeBeaconEvent('@alice:server.org', { geoUri, timestamp });
|
||||
const text = `Location ${geoUri} at ${new Date(timestamp).toISOString()}`;
|
||||
const expectedContent = {
|
||||
msgtype: "m.location",
|
||||
body: text,
|
||||
[TEXT_NODE_TYPE.name]: text,
|
||||
[M_ASSET.name]: { type: LocationAssetType.Pin },
|
||||
[M_LOCATION.name]: {
|
||||
uri: geoUri,
|
||||
description: undefined,
|
||||
},
|
||||
geo_uri: geoUri,
|
||||
[M_TIMESTAMP.name]: timestamp,
|
||||
};
|
||||
const wrapper = await mountForwardDialog(beaconEvent);
|
||||
|
||||
expect(wrapper.find('MLocationBody').length).toBeTruthy();
|
||||
|
||||
sendToFirstRoom(wrapper);
|
||||
|
||||
expect(mockClient.sendEvent).toHaveBeenCalledWith(
|
||||
roomId, EventType.RoomMessage, expectedContent,
|
||||
);
|
||||
});
|
||||
|
||||
it('forwards pin drop event', async () => {
|
||||
const wrapper = await mountForwardDialog(pinDropLocationEvent);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue