|
|
|
@ -840,20 +840,8 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
const showRetry = status === 'error' && direction === 'outgoing';
|
|
|
|
|
const fileName =
|
|
|
|
|
attachments && attachments[0] ? attachments[0].fileName : null;
|
|
|
|
|
const isDangerous = isFileDangerous(fileName || '');
|
|
|
|
|
const multipleAttachments = attachments && attachments.length > 1;
|
|
|
|
|
|
|
|
|
|
// Wraps a function to prevent event propagation, thus preventing
|
|
|
|
|
// message selection whenever any of the menu buttons are pressed.
|
|
|
|
|
const wrap = (f: any, ...args: Array<any>) => (e: any) => {
|
|
|
|
|
e.event.stopPropagation();
|
|
|
|
|
if (f) {
|
|
|
|
|
f(...args);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onContextMenuShown = () => {
|
|
|
|
|
window.contextMenuShown = true;
|
|
|
|
|
};
|
|
|
|
@ -880,7 +868,6 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
{!multipleAttachments && attachments && attachments[0] ? (
|
|
|
|
|
<Item
|
|
|
|
|
onClick={(e: any) => {
|
|
|
|
|
e.event.stopPropagation();
|
|
|
|
|
if (onDownload) {
|
|
|
|
|
onDownload(attachments[0]);
|
|
|
|
|
}
|
|
|
|
@ -890,15 +877,13 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
</Item>
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
<Item onClick={wrap(onCopyText)}>{window.i18n('copyMessage')}</Item>
|
|
|
|
|
<Item onClick={onCopyText}>{window.i18n('copyMessage')}</Item>
|
|
|
|
|
<Item onClick={this.onReplyPrivate}>
|
|
|
|
|
{window.i18n('replyToMessage')}
|
|
|
|
|
</Item>
|
|
|
|
|
<Item onClick={wrap(onShowDetail)}>
|
|
|
|
|
{window.i18n('moreInformation')}
|
|
|
|
|
</Item>
|
|
|
|
|
<Item onClick={onShowDetail}>{window.i18n('moreInformation')}</Item>
|
|
|
|
|
{showRetry ? (
|
|
|
|
|
<Item onClick={wrap(onRetrySend)}>{window.i18n('resend')}</Item>
|
|
|
|
|
<Item onClick={onRetrySend}>{window.i18n('resend')}</Item>
|
|
|
|
|
) : null}
|
|
|
|
|
{isDeletable ? (
|
|
|
|
|
<>
|
|
|
|
@ -919,7 +904,7 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
</>
|
|
|
|
|
) : null}
|
|
|
|
|
{isModerator && isPublic ? (
|
|
|
|
|
<Item onClick={wrap(onBanUser)}>{window.i18n('banUser')}</Item>
|
|
|
|
|
<Item onClick={onBanUser}>{window.i18n('banUser')}</Item>
|
|
|
|
|
) : null}
|
|
|
|
|
</Menu>
|
|
|
|
|
);
|
|
|
|
@ -1189,8 +1174,6 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private onReplyPrivate(e: any) {
|
|
|
|
|
e.event.stopPropagation();
|
|
|
|
|
e.event.preventDefault();
|
|
|
|
|
if (this.props && this.props.onReply) {
|
|
|
|
|
this.props.onReply(this.props.timestamp);
|
|
|
|
|
}
|
|
|
|
|