mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
Extract actionable content check to helper
This commit is contained in:
parent
7f62cdf124
commit
00ca930d2e
1 changed files with 15 additions and 7 deletions
|
@ -87,15 +87,13 @@ export default class MessageActionBar extends React.PureComponent {
|
|||
this.onFocusChange(true);
|
||||
}
|
||||
|
||||
render() {
|
||||
isContentActionable() {
|
||||
const { mxEvent } = this.props;
|
||||
const { status: eventStatus } = mxEvent;
|
||||
|
||||
// status is SENT before remote-echo, null after
|
||||
const isSent = !eventStatus || eventStatus === EventStatus.SENT;
|
||||
|
||||
let replyButton;
|
||||
|
||||
if (isSent && mxEvent.getType() === 'm.room.message') {
|
||||
const content = mxEvent.getContent();
|
||||
if (
|
||||
|
@ -103,13 +101,23 @@ export default class MessageActionBar extends React.PureComponent {
|
|||
content.msgtype !== 'm.bad.encrypted' &&
|
||||
content.hasOwnProperty('body')
|
||||
) {
|
||||
replyButton = <span className="mx_MessageActionBar_replyButton"
|
||||
title={_t("Reply")}
|
||||
onClick={this.onReplyClick}
|
||||
/>;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
render() {
|
||||
let replyButton;
|
||||
|
||||
if (this.isContentActionable()) {
|
||||
replyButton = <span className="mx_MessageActionBar_replyButton"
|
||||
title={_t("Reply")}
|
||||
onClick={this.onReplyClick}
|
||||
/>;
|
||||
}
|
||||
|
||||
return <div className="mx_MessageActionBar">
|
||||
{replyButton}
|
||||
<span className="mx_MessageActionBar_optionsButton"
|
||||
|
|
Loading…
Reference in a new issue