Fix context when using subtree of components
parent
4517fea496
commit
ddf558b3ed
|
|
@ -145,10 +145,12 @@ export default class MessageActionBar extends React.PureComponent {
|
||||||
let editButton;
|
let editButton;
|
||||||
|
|
||||||
if (isContentActionable(this.props.mxEvent)) {
|
if (isContentActionable(this.props.mxEvent)) {
|
||||||
if (this.context.room.canReact) {
|
// `context` can be null in tests that use a subtree of components
|
||||||
|
// that don't create the context.
|
||||||
|
if (!this.context || !this.context.room || this.context.room.canReact) {
|
||||||
reactButton = this.renderReactButton();
|
reactButton = this.renderReactButton();
|
||||||
}
|
}
|
||||||
if (this.context.room.canReply) {
|
if (!this.context || !this.context.room || this.context.room.canReply) {
|
||||||
replyButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_replyButton"
|
replyButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_replyButton"
|
||||||
title={_t("Reply")}
|
title={_t("Reply")}
|
||||||
onClick={this.onReplyClick}
|
onClick={this.onReplyClick}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue