Switch to using stable values for threads (#8019)
This commit is contained in:
@@ -15,8 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { createRef, KeyboardEvent } from 'react';
|
||||
import { Thread, ThreadEvent } from 'matrix-js-sdk/src/models/thread';
|
||||
import { RelationType } from 'matrix-js-sdk/src/@types/event';
|
||||
import { Thread, ThreadEvent, THREAD_RELATION_TYPE } from 'matrix-js-sdk/src/models/thread';
|
||||
import { Room } from 'matrix-js-sdk/src/models/room';
|
||||
import { IEventRelation, MatrixEvent } from 'matrix-js-sdk/src/models/event';
|
||||
import { TimelineWindow } from 'matrix-js-sdk/src/timeline-window';
|
||||
@@ -181,7 +180,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
||||
this.setState({
|
||||
thread,
|
||||
lastThreadReply: thread.lastReply((ev: MatrixEvent) => {
|
||||
return ev.isRelation(RelationType.Thread) && !ev.status;
|
||||
return ev.isRelation(THREAD_RELATION_TYPE.name) && !ev.status;
|
||||
}),
|
||||
}, async () => {
|
||||
thread.emit(ThreadEvent.ViewThread);
|
||||
@@ -201,7 +200,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
||||
if (this.state.thread) {
|
||||
this.setState({
|
||||
lastThreadReply: this.state.thread.lastReply((ev: MatrixEvent) => {
|
||||
return ev.isRelation(RelationType.Thread) && !ev.status;
|
||||
return ev.isRelation(THREAD_RELATION_TYPE.name) && !ev.status;
|
||||
}),
|
||||
});
|
||||
}
|
||||
@@ -288,7 +287,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
||||
|
||||
private get threadRelation(): IEventRelation {
|
||||
return {
|
||||
"rel_type": RelationType.Thread,
|
||||
"rel_type": THREAD_RELATION_TYPE.name,
|
||||
"event_id": this.state.thread?.id,
|
||||
"m.in_reply_to": {
|
||||
"event_id": this.state.lastThreadReply?.getId() ?? this.state.thread?.id,
|
||||
|
||||
Reference in New Issue
Block a user