Fix thread creation
This commit is contained in:
parent
404ddad961
commit
6c60e4c306
1 changed files with 9 additions and 5 deletions
|
@ -32,6 +32,7 @@ import dis from "../../dispatcher/dispatcher";
|
||||||
import { ActionPayload } from '../../dispatcher/payloads';
|
import { ActionPayload } from '../../dispatcher/payloads';
|
||||||
import { SetRightPanelPhasePayload } from '../../dispatcher/payloads/SetRightPanelPhasePayload';
|
import { SetRightPanelPhasePayload } from '../../dispatcher/payloads/SetRightPanelPhasePayload';
|
||||||
import { Action } from '../../dispatcher/actions';
|
import { Action } from '../../dispatcher/actions';
|
||||||
|
import { MatrixClientPeg } from '../../MatrixClientPeg';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
room: Room;
|
room: Room;
|
||||||
|
@ -89,12 +90,15 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
private setupThread = (mxEv: MatrixEvent) => {
|
private setupThread = (mxEv: MatrixEvent) => {
|
||||||
const thread = mxEv.getThread();
|
let thread = mxEv.getThread();
|
||||||
if (thread) {
|
if (!thread) {
|
||||||
thread.on("Thread.update", this.updateThread);
|
const client = MatrixClientPeg.get();
|
||||||
thread.once("Thread.ready", this.updateThread);
|
thread = new Thread([mxEv], this.props.room, client);
|
||||||
this.updateThread(thread);
|
mxEv.setThread(thread);
|
||||||
}
|
}
|
||||||
|
thread.on("Thread.update", this.updateThread);
|
||||||
|
thread.once("Thread.ready", this.updateThread);
|
||||||
|
this.updateThread(thread);
|
||||||
};
|
};
|
||||||
|
|
||||||
private teardownThread = () => {
|
private teardownThread = () => {
|
||||||
|
|
Loading…
Reference in a new issue