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

[MM-42101] Implement option to enable calls by default #10

Merged
merged 2 commits into from
Feb 28, 2022
Merged

Conversation

streamer45
Copy link
Collaborator

Summary

We are adding a new DefaultEnabled config option that controls whether Calls should be enabled in all channels by default (opt-out model).

Ticket Link

https://mattermost.atlassian.net/browse/MM-42101

@streamer45 streamer45 added the 2: Dev Review Requires review by a core committer label Feb 28, 2022
@streamer45 streamer45 self-assigned this Feb 28, 2022
Comment on lines +72 to +75
if cfg.DefaultEnabled != nil && *cfg.DefaultEnabled {
state = &channelState{
Enabled: true,
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This essentially means we are implicitly enabling channels calls upon first call. An alternate approach was to leave it unset but that required data schema changes (converting bool to pointer to have the additional state) and it felt more convoluted overall. Happy to hear feedback though.

Comment on lines +81 to +83
if !state.Enabled {
return nil, fmt.Errorf("calls are not enabled")
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interestingly, from a server perspective it was possible to start a call on a channel with calls disabled.

@@ -112,8 +112,7 @@ export default class CallsClient extends EventEmitter {
this.ws = ws;

ws.on('error', (err) => {
console.log(`ws error: ${err}`);
this.ws = null;
Copy link
Collaborator Author

@streamer45 streamer45 Feb 28, 2022

Choose a reason for hiding this comment

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

This was preventing the ws connection from disconnecting in case of server side error (e.g. during join).

Copy link
Member

Choose a reason for hiding this comment

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

Nice catch!

@streamer45 streamer45 requested a review from cpoile February 28, 2022 13:34
Copy link
Member

@cpoile cpoile left a comment

Choose a reason for hiding this comment

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

👍

@@ -112,8 +112,7 @@ export default class CallsClient extends EventEmitter {
this.ws = ws;

ws.on('error', (err) => {
console.log(`ws error: ${err}`);
this.ws = null;
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch!

@cpoile cpoile added 3: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Feb 28, 2022
@cpoile cpoile merged commit dd88a49 into main Feb 28, 2022
@cpoile cpoile deleted the MM-42101 branch February 28, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants