Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix context when using subtree of components
Browse files Browse the repository at this point in the history
  • Loading branch information
jryans committed Jul 31, 2019
1 parent 4517fea commit ddf558b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/views/messages/MessageActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ export default class MessageActionBar extends React.PureComponent {
let editButton;

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();
}
if (this.context.room.canReply) {
if (!this.context || !this.context.room || this.context.room.canReply) {
replyButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_replyButton"
title={_t("Reply")}
onClick={this.onReplyClick}
Expand Down

0 comments on commit ddf558b

Please sign in to comment.