Live location sharing - add configs to render beacon_info in timeline (#8251)
* add configs to render beacon_info in timeline Signed-off-by: Kerry Archibald <kerrya@element.io> * fix copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * one more comment Signed-off-by: Kerry Archibald <kerrya@element.io> * update beacon identifier Signed-off-by: Kerry Archibald <kerrya@element.io> * use special case for beacon_info tile mapper Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
03d0969ae3
commit
f63923d60f
4 changed files with 71 additions and 1 deletions
|
@ -19,6 +19,7 @@ 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";
|
||||
|
@ -211,9 +212,17 @@ export function pickFactory(mxEvent: MatrixEvent, cli: MatrixClient, asHiddenEv?
|
|||
|
||||
// Try and pick a state event factory, if we can.
|
||||
if (mxEvent.isState()) {
|
||||
if (
|
||||
M_BEACON_INFO.matches(evType) &&
|
||||
SettingsStore.getValue("feature_location_share_live")
|
||||
) {
|
||||
return MessageEventFactory;
|
||||
}
|
||||
|
||||
if (SINGULAR_STATE_EVENTS.has(evType) && mxEvent.getStateKey() !== '') {
|
||||
return noEventFactoryFactory(); // improper event type to render
|
||||
}
|
||||
|
||||
return STATE_EVENT_TILE_TYPES[evType] ?? noEventFactoryFactory();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue