Use cached setting values when calling TextForEvent

Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
Robin Townsend 2021-06-16 20:40:47 -04:00
parent 819fe419b7
commit af11878e0c
7 changed files with 28 additions and 13 deletions

View file

@ -17,6 +17,7 @@ limitations under the License.
import React from 'react';
import PropTypes from 'prop-types';
import RoomContext from "../../../contexts/RoomContext";
import * as TextForEvent from "../../../TextForEvent";
import {replaceableComponent} from "../../../utils/replaceableComponent";
@ -27,8 +28,10 @@ export default class TextualEvent extends React.Component {
mxEvent: PropTypes.object.isRequired,
};
static contextType = RoomContext;
render() {
const text = TextForEvent.textForEvent(this.props.mxEvent);
const text = TextForEvent.textForEvent(this.props.mxEvent, this.context?.showHiddenEventsInTimeline);
if (text == null || text.length === 0) return null;
return (
<div className="mx_TextualEvent">{ text }</div>