Add 'from a thread' copy to search tile result (#7525)

This commit is contained in:
Germain 2022-01-12 17:16:00 +00:00 committed by GitHub
parent 61116377f3
commit 3a18fd8f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 35 deletions

View file

@ -666,29 +666,31 @@ export default class EventTile extends React.Component<IProps, IState> {
}
private renderThreadInfo(): React.ReactNode {
if (!this.thread) {
return null;
if (this.props.timelineRenderingType === TimelineRenderingType.Search && this.props.mxEvent.threadRootId) {
return (
<p className="mx_ThreadSummaryIcon">{ _t("From a thread") }</p>
);
} else if (this.thread) {
return (
<CardContext.Consumer>
{ context =>
<div
className="mx_ThreadInfo"
onClick={() => {
showThread({ rootEvent: this.props.mxEvent, push: context.isCard });
}}
>
<span className="mx_ThreadInfo_threads-amount">
{ _t("%(count)s reply", {
count: this.thread.length,
}) }
</span>
{ this.renderThreadLastMessagePreview() }
</div>
}
</CardContext.Consumer>
);
}
return (
<CardContext.Consumer>
{ context =>
<div
className="mx_ThreadInfo"
onClick={() => {
showThread({ rootEvent: this.props.mxEvent, push: context.isCard });
}}
>
<span className="mx_ThreadInfo_threads-amount">
{ _t("%(count)s reply", {
count: this.thread.length,
}) }
</span>
{ this.renderThreadLastMessagePreview() }
</div>
}
</CardContext.Consumer>
);
}
private onRoomReceipt = (ev: MatrixEvent, room: Room): void => {