Update lastReply to filter out local event ID from thread fallback (#7620)
This commit is contained in:
parent
1d02e61655
commit
ecd5be8a8f
3 changed files with 10 additions and 6 deletions
|
@ -88,7 +88,7 @@ async function getThreadTimelineSet(
|
||||||
const timelineSet = new EventTimelineSet(room, {});
|
const timelineSet = new EventTimelineSet(room, {});
|
||||||
|
|
||||||
Array.from(room.threads)
|
Array.from(room.threads)
|
||||||
.sort(([, threadA], [, threadB]) => threadA.lastReply.getTs() - threadB.lastReply.getTs())
|
.sort(([, threadA], [, threadB]) => threadA.lastReply().getTs() - threadB.lastReply().getTs())
|
||||||
.forEach(([, thread]) => {
|
.forEach(([, thread]) => {
|
||||||
const isOwnEvent = thread.rootEvent.getSender() === client.getUserId();
|
const isOwnEvent = thread.rootEvent.getSender() === client.getUserId();
|
||||||
if (filterType !== ThreadFilterType.My || isOwnEvent) {
|
if (filterType !== ThreadFilterType.My || isOwnEvent) {
|
||||||
|
|
|
@ -166,7 +166,9 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
||||||
if (thread && this.state.thread !== thread) {
|
if (thread && this.state.thread !== thread) {
|
||||||
this.setState({
|
this.setState({
|
||||||
thread,
|
thread,
|
||||||
lastThreadReply: thread.lastReply,
|
lastThreadReply: thread.lastReply((ev: MatrixEvent) => {
|
||||||
|
return !ev.status;
|
||||||
|
}),
|
||||||
}, () => {
|
}, () => {
|
||||||
thread.emit(ThreadEvent.ViewThread);
|
thread.emit(ThreadEvent.ViewThread);
|
||||||
this.timelinePanelRef.current?.refreshTimeline();
|
this.timelinePanelRef.current?.refreshTimeline();
|
||||||
|
@ -177,7 +179,9 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
||||||
private updateLastThreadReply = () => {
|
private updateLastThreadReply = () => {
|
||||||
if (this.state.thread) {
|
if (this.state.thread) {
|
||||||
this.setState({
|
this.setState({
|
||||||
lastThreadReply: this.state.thread.lastReply,
|
lastThreadReply: this.state.thread.lastReply((ev: MatrixEvent) => {
|
||||||
|
return !ev.status;
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -402,7 +402,7 @@ export default class EventTile extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
thread,
|
thread,
|
||||||
threadReplyCount: thread?.length,
|
threadReplyCount: thread?.length,
|
||||||
threadLastReply: thread?.lastReply,
|
threadLastReply: thread?.lastReply(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// don't do RR animations until we are mounted
|
// don't do RR animations until we are mounted
|
||||||
|
@ -556,7 +556,7 @@ export default class EventTile extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
threadLastReply: thread?.lastReply,
|
threadLastReply: thread?.lastReply(),
|
||||||
threadReplyCount: thread?.length,
|
threadReplyCount: thread?.length,
|
||||||
thread,
|
thread,
|
||||||
});
|
});
|
||||||
|
@ -1271,7 +1271,7 @@ export default class EventTile extends React.Component<IProps, IState> {
|
||||||
// Thread panel shows the timestamp of the last reply in that thread
|
// Thread panel shows the timestamp of the last reply in that thread
|
||||||
const ts = this.props.tileShape !== TileShape.ThreadPanel
|
const ts = this.props.tileShape !== TileShape.ThreadPanel
|
||||||
? this.props.mxEvent.getTs()
|
? this.props.mxEvent.getTs()
|
||||||
: thread?.lastReply.getTs();
|
: thread?.lastReply().getTs();
|
||||||
|
|
||||||
const timestamp = showTimestamp && ts ?
|
const timestamp = showTimestamp && ts ?
|
||||||
<MessageTimestamp
|
<MessageTimestamp
|
||||||
|
|
Loading…
Reference in a new issue