-
Notifications
You must be signed in to change notification settings - Fork 39
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-58259] [MM-58260] Move the /call end command to host controls #747
Conversation
I think there is a reason because I remember fixing related issues. I think this way you could still get the toast to show even when leaving a call (only you in the call). The call technically ends but we are not sending any event to clear the state. |
@streamer45 Ah, I see that now. So a couple thoughts, 1) I'll add an e2e test for that, cause that obviously shouldn't be happening when then call is over, 2) What do you think about sending a |
Yes, I think that makes sense. Let's just make sure this is tracked through the unique call ID so that we don't get into funny situations since a new call could start right after. |
@@ -327,7 +326,7 @@ export default class Plugin { | |||
|
|||
// following the thread only on join. On call start | |||
// this is done in the call_start ws event handler. | |||
if (profilesInCallInChannel(store.getState(), channelId).length > 0) { | |||
if (channelHasCall(store.getState(), channelId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea behind these refactorings are to move logic (like length tests) into the selectors, and make the selector's name declare what it does. This means more selectors, but it's clearer and the logic is isolated to one place.
Then, if we decide that counting participants is more correct, we can make that change in the selector.
@@ -402,8 +402,14 @@ export const userLeft = (channelID: string, userID: string, sessionID: string) = | |||
}, | |||
}); | |||
|
|||
if (ringingEnabled(getState()) && !channelHasCall(getState(), channelID)) { | |||
await dispatch(removeIncomingCallNotification(callID)); | |||
if (numSessionsInCallInChannel(getState(), channelID) === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting this because it's a big change. This is what we do in mobile and it seems to simplify things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implicitly thought we would handle this case server-side and send the unique call ID because this does not protect us against a race, as we still use the channel ID to figure out the locally stored call ID. It's not a huge deal, but it's something to note.
# Conflicts: # server/api.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to review this. The approach makes sense to me.
I am still seeing some weirdness but at this point I can't easily tell if it's a regression or not but still something we could look into as part of this PR.
If a user joins a call and then leaves I think we should show the toast once more. This doesn't seem to happen. What's weirder is that not even refreshing gets it back.
@streamer45 We changed that behavior back in #445: dismissing the toast or joining (via toast or post button) dismisses the banner and it won't come back. If we want to change that behavior, then maybe we should open a new ticket? |
Ah, forgot about that. Never mind then if it's working as designed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nothing blocking.
@@ -402,8 +402,14 @@ export const userLeft = (channelID: string, userID: string, sessionID: string) = | |||
}, | |||
}); | |||
|
|||
if (ringingEnabled(getState()) && !channelHasCall(getState(), channelID)) { | |||
await dispatch(removeIncomingCallNotification(callID)); | |||
if (numSessionsInCallInChannel(getState(), channelID) === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implicitly thought we would handle this case server-side and send the unique call ID because this does not protect us against a race, as we still use the channel ID to figure out the locally stored call ID. It's not a huge deal, but it's something to note.
@streamer45 Can you elaborate on what the race condition would be? I don't see how there could be one here... |
@cpoile The only concern is a call in the same channel starting right after the previous one and incorrectly cleaning up the redux state for the latter one. |
@streamer45 I don't think that's possible since it's all synchronous now. (I removed an async that could let that happen, even if the chances of that would be incredibly small.) |
Yeah, I haven't checked the whole path, including corner cases like WS reconnects, but if it worked fine on mobile until now, we should be good. |
@cpoile Can we merge? So I can prepare a build for Community and start the soaking process. |
Summary
/call end
command to the host controls router/call end
-- before they would stay visible after/call end
, now they are gone. Let me know if there was a particular reason we were using profile count as a proxy for the call being active -- if so, then maybe should fix that instead.Ticket Link