From 982b1d39e91200d7e627d9b1090625d05423744e Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 5 Feb 2020 13:40:44 -0300 Subject: [PATCH] [FIX] Disallow empty sharing (#1664) --- app/containers/MessageActions.js | 3 +++ app/views/InviteUsersView/index.js | 2 +- app/views/RoomActionsView/index.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/containers/MessageActions.js b/app/containers/MessageActions.js index 36022756..0c294533 100644 --- a/app/containers/MessageActions.js +++ b/app/containers/MessageActions.js @@ -262,6 +262,9 @@ class MessageActions extends React.Component { handleShare = async() => { const { message } = this.props; const permalink = await this.getPermalink(message); + if (!permalink) { + return; + } Share.share({ message: permalink }); diff --git a/app/views/InviteUsersView/index.js b/app/views/InviteUsersView/index.js index f8609587..2df7ee06 100644 --- a/app/views/InviteUsersView/index.js +++ b/app/views/InviteUsersView/index.js @@ -52,7 +52,7 @@ class InviteUsersView extends React.Component { share = () => { const { invite } = this.props; - if (!invite) { + if (!invite || !invite.url) { return; } Share.share({ message: invite.url }); diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index 84661f25..a1de3802 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -389,6 +389,9 @@ class RoomActionsView extends React.Component { handleShare = () => { const { room } = this.state; const permalink = RocketChat.getPermalinkChannel(room); + if (!permalink) { + return; + } Share.share({ message: permalink });