From 58d21be195dbb87f833de68079c01f47fbfab0f4 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Fri, 2 Jul 2021 16:15:21 -0300 Subject: [PATCH] [IMPROVE] Add Jitsi button to Teams (#3223) * [IMPROVE] Add Jitsi button to teams * Added setting to check is Jitsi is Enable for Channel too * Fix typo Co-authored-by: Gerzon Z Co-authored-by: Gerzon Z Co-authored-by: Diego Mello --- app/constants/settings.js | 6 ++++++ app/views/RoomActionsView/index.js | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/constants/settings.js b/app/constants/settings.js index d684a11c..14ad8fb3 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -196,5 +196,11 @@ export default { }, Accounts_AllowInvisibleStatusOption: { type: 'valueAsString' + }, + Jitsi_Enable_Teams: { + type: 'valueAsBoolean' + }, + Jitsi_Enable_Channels: { + type: 'valuesAsBoolean' } }; diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index d16ea576..75c977a2 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -50,6 +50,8 @@ class RoomActionsView extends React.Component { route: PropTypes.object, leaveRoom: PropTypes.func, jitsiEnabled: PropTypes.bool, + jitsiEnableTeams: PropTypes.bool, + jitsiEnableChannels: PropTypes.bool, encryptionEnabled: PropTypes.bool, setLoadingInvite: PropTypes.func, closeRoom: PropTypes.func, @@ -655,10 +657,15 @@ class RoomActionsView extends React.Component { renderJitsi = () => { const { room } = this.state; - const { jitsiEnabled } = this.props; - if (!jitsiEnabled || room.teamMain) { + const { jitsiEnabled, jitsiEnableTeams, jitsiEnableChannels } = this.props; + + const isJitsiDisabledForTeams = room.teamMain && !jitsiEnableTeams; + const isJitsiDisabledForChannels = !room.teamMain && (room.t === 'p' || room.t === 'c') && !jitsiEnableChannels; + + if (!jitsiEnabled || isJitsiDisabledForTeams || isJitsiDisabledForChannels) { return null; } + return ( @@ -1078,6 +1085,8 @@ class RoomActionsView extends React.Component { const mapStateToProps = state => ({ jitsiEnabled: state.settings.Jitsi_Enabled || false, + jitsiEnableTeams: state.settings.Jitsi_Enable_Teams || false, + jitsiEnableChannels: state.settings.Jitsi_Enable_Channels || false, encryptionEnabled: state.encryption.enabled, serverVersion: state.server.version, isMasterDetail: state.app.isMasterDetail,