Adapt threading UI to new backend

This commit is contained in:
Germain Souquet 2021-08-17 10:38:09 +01:00
parent d971802789
commit e5024c4b71
7 changed files with 150 additions and 8 deletions

View file

@ -26,12 +26,14 @@ import { MatrixClientPeg } from '../../MatrixClientPeg';
import ResizeNotifier from '../../utils/ResizeNotifier';
import EventTile from '../views/rooms/EventTile';
import MessageComposer from '../views/rooms/MessageComposer';
import { RoomPermalinkCreator } from '../../utils/permalinks/Permalinks';
interface IProps {
roomId: string;
onClose: () => void;
resizeNotifier: ResizeNotifier;
mxEvent: MatrixEvent;
permalinkCreator?: RoomPermalinkCreator;
}
interface IState {
@ -44,9 +46,18 @@ interface IState {
class ThreadView extends React.Component<IProps, IState> {
state = {};
public componentDidMount(): void {}
public componentDidMount(): void {
// this.props.mxEvent.getThread().on("Thread.update", this.updateThread);
this.props.mxEvent.getThread().once("Thread.ready", this.updateThread);
}
public componentWillUnmount(): void {}
public componentWillUnmount(): void {
this.props.mxEvent.getThread().removeListener("Thread.update", this.updateThread);
}
updateThread = () => {
this.forceUpdate();
};
public renderEventTile(event: MatrixEvent): JSX.Element {
return <EventTile
@ -59,9 +70,8 @@ class ThreadView extends React.Component<IProps, IState> {
}
public render() {
const client = MatrixClientPeg.get();
const room = client.getRoom(this.props.roomId);
const thread = room.getThread(this.props.mxEvent.getId());
const thread = this.props.mxEvent.getThread();
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
return (
<BaseCard
className="mx_ThreadView"
@ -80,7 +90,7 @@ class ThreadView extends React.Component<IProps, IState> {
room={room}
resizeNotifier={this.props.resizeNotifier}
replyToEvent={this.props.mxEvent}
permalinkCreator={null}
permalinkCreator={this.props.permalinkCreator}
/>
</BaseCard>
);