Add right click option to public chat messages to copy pubkey of sender

pull/387/head
Beaudan 6 years ago committed by Beaudan Brown
parent f4e76f0576
commit 616e952f8e

@ -678,6 +678,7 @@
this.getSource() === this.OUR_NUMBER, this.getSource() === this.OUR_NUMBER,
onCopyText: () => this.copyText(), onCopyText: () => this.copyText(),
onCopyPubKey: () => this.copyPubKey(),
onReply: () => this.trigger('reply', this), onReply: () => this.trigger('reply', this),
onRetrySend: () => this.retrySend(), onRetrySend: () => this.retrySend(),
onShowDetail: () => this.trigger('show-message-detail', this), onShowDetail: () => this.trigger('show-message-detail', this),
@ -964,6 +965,17 @@
}; };
}, },
copyPubKey() {
if (this.isIncoming()) {
clipboard.writeText(this.get('source'));
} else {
clipboard.writeText(this.OUR_NUMBER);
}
window.Whisper.events.trigger('showToast', {
message: i18n('copiedPublicKey'),
});
},
copyText() { copyText() {
clipboard.writeText(this.get('body')); clipboard.writeText(this.get('body'));
window.Whisper.events.trigger('showToast', { window.Whisper.events.trigger('showToast', {

@ -97,6 +97,7 @@ export interface Props {
onRetrySend?: () => void; onRetrySend?: () => void;
onDownload?: (isDangerous: boolean) => void; onDownload?: (isDangerous: boolean) => void;
onDelete?: () => void; onDelete?: () => void;
onCopyPubKey?: () => void;
onShowDetail: () => void; onShowDetail: () => void;
} }
@ -826,6 +827,8 @@ export class Message extends React.PureComponent<Props, State> {
onReply, onReply,
onRetrySend, onRetrySend,
onShowDetail, onShowDetail,
onCopyPubKey,
isPublic,
i18n, i18n,
} = this.props; } = this.props;
@ -888,6 +891,9 @@ export class Message extends React.PureComponent<Props, State> {
{i18n('deleteMessage')} {i18n('deleteMessage')}
</MenuItem> </MenuItem>
) : null} ) : null}
{isPublic ? (
<MenuItem onClick={onCopyPubKey}>{i18n('copyPublicKey')}</MenuItem>
) : null}
</ContextMenu> </ContextMenu>
); );
} }

Loading…
Cancel
Save