LLS: Remove beacon info illegal replace relation (#8390)

* dont apply illegal replace relation to beacon_info event

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

* only display tiles for beacon infos with live prop

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

* copyrights

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-04-22 13:38:27 +02:00 committed by GitHub
parent 763edb7ab9
commit a3a7c60dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 37 deletions

View file

@ -19,7 +19,6 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { EventType, MsgType, RelationType } from "matrix-js-sdk/src/@types/event";
import { M_POLL_START, Optional } from "matrix-events-sdk";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";
import EditorStateTransfer from "../utils/EditorStateTransfer";
import { RoomPermalinkCreator } from "../utils/permalinks/Permalinks";
@ -44,6 +43,7 @@ import { getMessageModerationState, MessageModerationState } from "../utils/Even
import HiddenBody from "../components/views/messages/HiddenBody";
import SettingsStore from "../settings/SettingsStore";
import ViewSourceEvent from "../components/views/messages/ViewSourceEvent";
import { shouldDisplayAsBeaconTile } from "../utils/beacon/timeline";
// Subset of EventTile's IProps plus some mixins
export interface EventTileTypeProps {
@ -219,7 +219,9 @@ export function pickFactory(
// Try and pick a state event factory, if we can.
if (mxEvent.isState()) {
if (
M_BEACON_INFO.matches(evType) &&
shouldDisplayAsBeaconTile(mxEvent) &&
// settings store access here temporarily during labs
// only hit when a beacon_info event is hit
SettingsStore.getValue("feature_location_share_live")
) {
return MessageEventFactory;