Use MatrixClientPeg::safeGet for strict typing (#10989)
This commit is contained in:
parent
d64018ce26
commit
9b5b053148
60 changed files with 225 additions and 203 deletions
|
@ -1166,7 +1166,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||
|
||||
let replyChain: JSX.Element | undefined;
|
||||
if (
|
||||
haveRendererForEvent(this.props.mxEvent, this.context.showHiddenEvents) &&
|
||||
haveRendererForEvent(this.props.mxEvent, MatrixClientPeg.safeGet(), this.context.showHiddenEvents) &&
|
||||
shouldDisplayReply(this.props.mxEvent)
|
||||
) {
|
||||
replyChain = (
|
||||
|
|
|
@ -27,6 +27,7 @@ import { shouldFormContinuation } from "../../structures/MessagePanel";
|
|||
import { wantsDateSeparator } from "../../../DateUtils";
|
||||
import LegacyCallEventGrouper, { buildLegacyCallEventGroupers } from "../../structures/LegacyCallEventGrouper";
|
||||
import { haveRendererForEvent } from "../../../events/EventTileFactory";
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
|
||||
interface IProps {
|
||||
// a list of strings to be highlighted in the results
|
||||
|
@ -69,6 +70,7 @@ export default class SearchResultTile extends React.Component<IProps> {
|
|||
const isTwelveHour = SettingsStore.getValue("showTwelveHourTimestamps");
|
||||
const alwaysShowTimestamps = SettingsStore.getValue("alwaysShowTimestamps");
|
||||
|
||||
const cli = MatrixClientPeg.safeGet();
|
||||
for (let j = 0; j < timeline.length; j++) {
|
||||
const mxEv = timeline[j];
|
||||
let highlights: string[] | undefined;
|
||||
|
@ -77,14 +79,20 @@ export default class SearchResultTile extends React.Component<IProps> {
|
|||
highlights = this.props.searchHighlights;
|
||||
}
|
||||
|
||||
if (haveRendererForEvent(mxEv, this.context?.showHiddenEvents)) {
|
||||
if (haveRendererForEvent(mxEv, cli, this.context?.showHiddenEvents)) {
|
||||
// do we need a date separator since the last event?
|
||||
const prevEv = timeline[j - 1];
|
||||
// is this a continuation of the previous message?
|
||||
const continuation =
|
||||
prevEv &&
|
||||
!wantsDateSeparator(prevEv.getDate() || undefined, mxEv.getDate() || undefined) &&
|
||||
shouldFormContinuation(prevEv, mxEv, this.context?.showHiddenEvents, TimelineRenderingType.Search);
|
||||
shouldFormContinuation(
|
||||
prevEv,
|
||||
mxEv,
|
||||
cli,
|
||||
this.context?.showHiddenEvents,
|
||||
TimelineRenderingType.Search,
|
||||
);
|
||||
|
||||
let lastInSection = true;
|
||||
const nextEv = timeline[j + 1];
|
||||
|
@ -99,6 +107,7 @@ export default class SearchResultTile extends React.Component<IProps> {
|
|||
!shouldFormContinuation(
|
||||
mxEv,
|
||||
nextEv,
|
||||
cli,
|
||||
this.context?.showHiddenEvents,
|
||||
TimelineRenderingType.Search,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue