Add a bit of safety around timestamp handling for threads (#8845)

This commit is contained in:
Travis Ralston 2022-06-14 22:43:20 -06:00 committed by GitHub
parent 39f2bbaaf4
commit 44b2667f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1121,9 +1121,13 @@ export class UnwrappedEventTile extends React.Component<IProps, IState> {
|| Boolean(this.state.contextMenu)); || Boolean(this.state.contextMenu));
// 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.context.timelineRenderingType !== TimelineRenderingType.ThreadsList let ts = this.context.timelineRenderingType !== TimelineRenderingType.ThreadsList
? this.props.mxEvent.getTs() ? this.props.mxEvent.getTs()
: this.state.thread?.replyToEvent.getTs(); : this.state.thread?.replyToEvent?.getTs();
if (typeof ts !== "number") {
// Fall back to something we can use
ts = this.props.mxEvent.getTs();
}
const messageTimestamp = <MessageTimestamp const messageTimestamp = <MessageTimestamp
showRelative={this.context.timelineRenderingType === TimelineRenderingType.ThreadsList} showRelative={this.context.timelineRenderingType === TimelineRenderingType.ThreadsList}