Live location share - open latest location in map site (#8981)
* move getForwardableBeacon to beacon utils * move event transform type up * add helper to get shareable-as-locaion events * use getShareableLocationEvent in MessageContextMenu * test opening in maplink * fix bad copy pasted tests
This commit is contained in:
parent
0026e0462b
commit
ed92071046
10 changed files with 310 additions and 17 deletions
|
@ -35,7 +35,6 @@ import {
|
|||
canPinEvent,
|
||||
editEvent,
|
||||
isContentActionable,
|
||||
isLocationEvent,
|
||||
} from '../../../utils/EventUtils';
|
||||
import IconizedContextMenu, { IconizedContextMenuOption, IconizedContextMenuOptionList } from './IconizedContextMenu';
|
||||
import { ReadPinsEventId } from "../right_panel/types";
|
||||
|
@ -58,6 +57,7 @@ import { OpenForwardDialogPayload } from "../../../dispatcher/payloads/OpenForwa
|
|||
import { OpenReportEventDialogPayload } from "../../../dispatcher/payloads/OpenReportEventDialogPayload";
|
||||
import { createMapSiteLinkFromEvent } from '../../../utils/location';
|
||||
import { getForwardableEvent } from '../../../events/forward/getForwardableEvent';
|
||||
import { getShareableLocationEvent } from '../../../events/location/getShareableLocationEvent';
|
||||
|
||||
interface IProps extends IPosition {
|
||||
chevronFace: ChevronFace;
|
||||
|
@ -145,10 +145,6 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
|
|||
return content.pinned && Array.isArray(content.pinned) && content.pinned.includes(this.props.mxEvent.getId());
|
||||
}
|
||||
|
||||
private canOpenInMapSite(mxEvent: MatrixEvent): boolean {
|
||||
return isLocationEvent(mxEvent);
|
||||
}
|
||||
|
||||
private canEndPoll(mxEvent: MatrixEvent): boolean {
|
||||
return (
|
||||
M_POLL_START.matches(mxEvent.getType()) &&
|
||||
|
@ -369,8 +365,9 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
|
|||
}
|
||||
|
||||
let openInMapSiteButton: JSX.Element;
|
||||
if (this.canOpenInMapSite(mxEvent)) {
|
||||
const mapSiteLink = createMapSiteLinkFromEvent(mxEvent);
|
||||
const shareableLocationEvent = getShareableLocationEvent(mxEvent, cli);
|
||||
if (shareableLocationEvent) {
|
||||
const mapSiteLink = createMapSiteLinkFromEvent(shareableLocationEvent);
|
||||
openInMapSiteButton = (
|
||||
<IconizedContextMenuOption
|
||||
iconClassName="mx_MessageContextMenu_iconOpenInMapSite"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue