From cf33ed58c1490477015c218bb227382747e3145c Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 8 Nov 2016 16:26:10 +0000 Subject: [PATCH 1/2] Add menu option for `external_url` if present --- .../views/context_menus/MessageContextMenu.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index ad7b340c8..9d06876e7 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -74,7 +74,7 @@ module.exports = React.createClass({ if (this.props.onFinished) this.props.onFinished(); }, - onPermalinkClick: function() { + onLinkClick: function() { if (this.props.onFinished) this.props.onFinished(); }, @@ -101,6 +101,7 @@ module.exports = React.createClass({ var cancelButton; var permalinkButton; var unhidePreviewButton; + var externalURLButton; if (eventStatus === 'not_sent') { resendButton = ( @@ -146,7 +147,7 @@ module.exports = React.createClass({ permalinkButton = (
Permalink + target="_blank" onClick={ this.onLinkClick }>Permalink
); @@ -156,6 +157,17 @@ module.exports = React.createClass({ ); + // Bridges can provide a 'external_url' to link back to the source. + if( typeof(this.props.mxEvent.event.content.external_url) === "string") { + externalURLButton = ( +
+ Source URL +
+ ); + } + + return (
{resendButton} @@ -165,6 +177,7 @@ module.exports = React.createClass({ {unhidePreviewButton} {permalinkButton} {UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null} + {externalURLButton}
); } From 15c730a22aba5e6f3625215bf4efd27880c190de Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 8 Nov 2016 17:08:50 +0000 Subject: [PATCH 2/2] Add rel="noopener" to context menu links. --- src/components/views/context_menus/MessageContextMenu.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index 9d06876e7..7786b9bd5 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -74,7 +74,7 @@ module.exports = React.createClass({ if (this.props.onFinished) this.props.onFinished(); }, - onLinkClick: function() { + closeMenu: function() { if (this.props.onFinished) this.props.onFinished(); }, @@ -147,7 +147,7 @@ module.exports = React.createClass({ permalinkButton = (
Permalink + target="_blank" rel="noopener" onClick={ this.closeMenu }>Permalink
); @@ -161,8 +161,8 @@ module.exports = React.createClass({ if( typeof(this.props.mxEvent.event.content.external_url) === "string") { externalURLButton = (
- Source URL + Source URL
); }