Overlay virtual room call events into main timeline (#9626)
* super WIP POC for merging virtual room events into main timeline * remove some debugs * c * add some todos * remove hardcoded fake virtual user * insert overlay events into main timeline without resorting main tl events * remove more debugs * add extra tick to roomview tests * RoomView test case for virtual room * test case for merged timeline * make overlay event filter generic * remove TODOs from LegacyCallEventGrouper * tidy comments * remove some newlines * test timelinepanel room timeline event handling * use newState.roomId * fix strict errors in RoomView * fix strict errors in TimelinePanel * add type * pr tweaks * strict errors * more strict fix * strict error whackamole * update ROomView tests to use rtl
This commit is contained in:
parent
1b6d753cfe
commit
6150b86421
7 changed files with 1171 additions and 85 deletions
|
@ -110,6 +110,8 @@ import { CallStore, CallStoreEvent } from "../../stores/CallStore";
|
|||
import { Call } from "../../models/Call";
|
||||
import { RoomSearchView } from './RoomSearchView';
|
||||
import eventSearch from "../../Searching";
|
||||
import VoipUserMapper from '../../VoipUserMapper';
|
||||
import { isCallEvent } from './LegacyCallEventGrouper';
|
||||
|
||||
const DEBUG = false;
|
||||
let debuglog = function(msg: string) {};
|
||||
|
@ -144,6 +146,7 @@ enum MainSplitContentType {
|
|||
}
|
||||
export interface IRoomState {
|
||||
room?: Room;
|
||||
virtualRoom?: Room;
|
||||
roomId?: string;
|
||||
roomAlias?: string;
|
||||
roomLoading: boolean;
|
||||
|
@ -654,7 +657,11 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
// NB: This does assume that the roomID will not change for the lifetime of
|
||||
// the RoomView instance
|
||||
if (initial) {
|
||||
newState.room = this.context.client.getRoom(newState.roomId);
|
||||
const virtualRoom = newState.roomId ?
|
||||
await VoipUserMapper.sharedInstance().getVirtualRoomForRoom(newState.roomId) : undefined;
|
||||
|
||||
newState.room = this.context.client!.getRoom(newState.roomId) || undefined;
|
||||
newState.virtualRoom = virtualRoom || undefined;
|
||||
if (newState.room) {
|
||||
newState.showApps = this.shouldShowApps(newState.room);
|
||||
this.onRoomLoaded(newState.room);
|
||||
|
@ -1264,7 +1271,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
});
|
||||
}
|
||||
|
||||
private onRoom = (room: Room) => {
|
||||
private onRoom = async (room: Room) => {
|
||||
if (!room || room.roomId !== this.state.roomId) {
|
||||
return;
|
||||
}
|
||||
|
@ -1277,8 +1284,10 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
);
|
||||
}
|
||||
|
||||
const virtualRoom = await VoipUserMapper.sharedInstance().getVirtualRoomForRoom(room.roomId);
|
||||
this.setState({
|
||||
room: room,
|
||||
virtualRoom: virtualRoom || undefined,
|
||||
}, () => {
|
||||
this.onRoomLoaded(room);
|
||||
});
|
||||
|
@ -1286,7 +1295,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
|
||||
private onDeviceVerificationChanged = (userId: string) => {
|
||||
const room = this.state.room;
|
||||
if (!room.currentState.getMember(userId)) {
|
||||
if (!room?.currentState.getMember(userId)) {
|
||||
return;
|
||||
}
|
||||
this.updateE2EStatus(room);
|
||||
|
@ -2093,7 +2102,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
hideMessagePanel = true;
|
||||
}
|
||||
|
||||
let highlightedEventId = null;
|
||||
let highlightedEventId: string | undefined;
|
||||
if (this.state.isInitialEventHighlighted) {
|
||||
highlightedEventId = this.state.initialEventId;
|
||||
}
|
||||
|
@ -2102,6 +2111,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
<TimelinePanel
|
||||
ref={this.gatherTimelinePanelRef}
|
||||
timelineSet={this.state.room.getUnfilteredTimelineSet()}
|
||||
overlayTimelineSet={this.state.virtualRoom?.getUnfilteredTimelineSet()}
|
||||
overlayTimelineSetFilter={isCallEvent}
|
||||
showReadReceipts={this.state.showReadReceipts}
|
||||
manageReadReceipts={!this.state.isPeeking}
|
||||
sendReadReceiptOnLoad={!this.state.wasContextSwitch}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue