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-58259] [MM-58260] Move the /call end command to host controls #747

Merged
merged 14 commits into from
May 28, 2024

Conversation

cpoile
Copy link
Member

@cpoile cpoile commented May 21, 2024

Summary

  • Move the /call end command to the host controls router
  • for [MM-58260]: Adjusted some of the checks in the toast and the channel link icon so that they properly disappear after /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

@cpoile cpoile added the 2: Dev Review Requires review by a core committer label May 21, 2024
@cpoile cpoile requested a review from streamer45 May 21, 2024 22:34
@cpoile cpoile changed the title [MM-58259] Move the /call end command to host controls [MM-58259] [MM-58260] Move the /call end command to host controls May 21, 2024
@streamer45 streamer45 added this to the v0.28.0 / MM 9.10 milestone May 21, 2024
@streamer45
Copy link
Contributor

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.

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.

@cpoile
Copy link
Member Author

cpoile commented May 22, 2024

@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 wsEventCallEnd event when we update the call's state EndAt? Since call is over, we should make sure the client knows it. Otherwise it feels like the participant counting is a hack.

@streamer45
Copy link
Contributor

@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 wsEventCallEnd event when we update the call's state EndAt? Since call is over, we should make sure the client knows it. Otherwise it feels like the participant counting is a hack.

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)) {
Copy link
Member Author

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) {
Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@streamer45 streamer45 left a 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.

@cpoile
Copy link
Member Author

cpoile commented May 27, 2024

@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?

@streamer45
Copy link
Contributor

@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.

@streamer45 streamer45 self-requested a review May 27, 2024 22:28
Copy link
Contributor

@streamer45 streamer45 left a 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) {
Copy link
Contributor

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.

@cpoile
Copy link
Member Author

cpoile commented May 28, 2024

@streamer45 Can you elaborate on what the race condition would be? I don't see how there could be one here...

@streamer45
Copy link
Contributor

@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.

@cpoile
Copy link
Member Author

cpoile commented May 28, 2024

@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.)

@streamer45
Copy link
Contributor

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.

@streamer45 streamer45 added 3: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels May 28, 2024
@streamer45
Copy link
Contributor

@cpoile Can we merge? So I can prepare a build for Community and start the soaking process.

@cpoile cpoile merged commit b501c6b into main May 28, 2024
19 checks passed
@cpoile cpoile deleted the MM-58259-end-call branch May 28, 2024 18:53
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.

None yet

2 participants