Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVE] Add Jitsi button to Teams #3223

Merged
merged 5 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,8 @@ export default {
},
Accounts_AllowInvisibleStatusOption: {
type: 'valueAsString'
},
Jitsi_Enable_Teams: {
type: 'valueAsBoolean'
}
};
6 changes: 4 additions & 2 deletions app/views/RoomActionsView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class RoomActionsView extends React.Component {
route: PropTypes.object,
leaveRoom: PropTypes.func,
jitsiEnabled: PropTypes.bool,
jitsiEnableTeams: PropTypes.bool,
encryptionEnabled: PropTypes.bool,
setLoadingInvite: PropTypes.func,
closeRoom: PropTypes.func,
Expand Down Expand Up @@ -655,8 +656,8 @@ class RoomActionsView extends React.Component {

renderJitsi = () => {
const { room } = this.state;
const { jitsiEnabled } = this.props;
if (!jitsiEnabled || room.teamMain) {
const { jitsiEnabled, jitsiEnableTeams } = this.props;
if (!jitsiEnabled || (room.teamMain && !jitsiEnableTeams)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation in case jitsi is or is not enabled for channels

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think on refactoring this whole logic.
Instead of thinking what's necessary to return null, I'd write the opposite.
Writing affirmative propositions are always easier to read than negative.
Something like this might work.
(room.teamId && jitsiEnableTeams && jitsiEnabled) || (!room.teamId && jitsiEnabled)

return null;
}
return (
Expand Down Expand Up @@ -1078,6 +1079,7 @@ class RoomActionsView extends React.Component {

const mapStateToProps = state => ({
jitsiEnabled: state.settings.Jitsi_Enabled || false,
jitsiEnableTeams: state.settings.Jitsi_Enable_Teams || false,
encryptionEnabled: state.encryption.enabled,
serverVersion: state.server.version,
isMasterDetail: state.app.isMasterDetail,
Expand Down