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

GH-109: Participant join before host webhook event #185

Closed
wants to merge 10 commits into from
Closed

GH-109: Participant join before host webhook event #185

wants to merge 10 commits into from

Conversation

andrew-the-drawer
Copy link
Contributor

@andrew-the-drawer andrew-the-drawer commented Oct 31, 2020

Summary

This PR supports sending updates and notifications to host if a participant joins before host in a Zoom meeting

To recognize whether host is already in the meeting, this PR utilize Participant joined webhook

Ticket Link

Fixes #109

@mattermod
Copy link
Contributor

Hello @lantrungseo,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@mattermod
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

@larkox
Copy link
Contributor

larkox commented Nov 13, 2020

@lantrungseo Is this ready to review, or are you still working on this? I see some lint errors in the build pipeline. Could you take a look at those?

@andrew-the-drawer
Copy link
Contributor Author

@larkox this is still in progress. It's gonna be finished soon.

@andrew-the-drawer andrew-the-drawer marked this pull request as ready for review November 22, 2020 15:27
@codecov
Copy link

codecov bot commented Nov 22, 2020

Codecov Report

Merging #185 (274a9b0) into master (45747e2) will decrease coverage by 1.05%.
The diff coverage is 10.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
- Coverage   20.85%   19.79%   -1.06%     
==========================================
  Files           7        7              
  Lines         729      778      +49     
==========================================
+ Hits          152      154       +2     
- Misses        536      582      +46     
- Partials       41       42       +1     
Impacted Files Coverage Δ
server/http.go 23.25% <10.52%> (-2.68%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45747e2...274a9b0. Read the comment docs.

@andrew-the-drawer
Copy link
Contributor Author

Ready for review!

@jasonblais jasonblais added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester and removed Lifecycle/1:stale Work In Progress Not yet ready for review labels Nov 23, 2020
Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

In general, looks pretty good to me, just two small details. Could you add screenshots of the final result?

post.Props["meeting_host_joined"] = isHostJoined
post.Props["meeting_waiting_count"] = waitingCnt
_, updatePostErr := p.API.UpdatePost(post)
_, err := w.Write([]byte(post.ToJson()))
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there is any need to write the post to the zoom. Maybe just an OK is enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I could fix that =))

_, updatePostErr := p.API.UpdatePost(post)
_, err := w.Write([]byte(post.ToJson()))
if err != nil || updatePostErr != nil {
p.API.LogWarn("failed to write response", "error", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

If err == nil and updatePostErr != nil, this will create a panic. Use two separate checks. That way you can introduce better errors for each case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay.

@andrew-the-drawer
Copy link
Contributor Author

In general, looks pretty good to me, just two small details. Could you add screenshots of the final result?

Yup, I will post the screen record of the whole flow here.

Copy link
Contributor

@mickmister mickmister 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 implementing this useful feature @lantrungseo! Functionally LGTM 👍 I have just a few requests regarding style.

@@ -219,18 +219,79 @@ func (p *Plugin) handleWebhook(w http.ResponseWriter, r *http.Request) {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR doesn't touch this part, but do you mind adding this to line 214?

defer r.Body.Close()

p.handleParticipantJoinedWebhook(w, r, &meetingWebhook)
return
}
if webhook.Event == zoom.EventTypeMeetingEnded {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add an extra line between these if blocks?

return
}
p.handleMeetingEnded(w, r, &meetingWebhook)
post, appErr := p.API.GetPost(postID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add an extra line after each if block in this function?

Comment on lines +86 to +89
let announcementText = '';
if (props.meeting_host_joined) {
announcementText = 'Host already in the meeting';
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about making this less lines like this?

Suggested change
let announcementText = '';
if (props.meeting_host_joined) {
announcementText = 'Host already in the meeting';
} else {
let announcementText = 'Host already in the meeting';
if (!props.meeting_host_joined) {

Comment on lines +92 to +93
}
if (props.meeting_waiting_count > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do this for better readability?

Suggested change
}
if (props.meeting_waiting_count > 1) {
} else if (props.meeting_waiting_count > 1) {

@mattermod
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

@jasonblais
Copy link
Contributor

@lantrungseo thank you for your contribution! Let us know if you have any questions about the feedback above, we'd be happy to help :)

@larkox
Copy link
Contributor

larkox commented Jan 13, 2021

@lantrungseo are you able to continue working on this issue?

@lindy65
Copy link

lindy65 commented May 27, 2021

Hi @lantrungseo - I'm helping to review stale PRs and, since we haven't heard from you in 6 months, I'll close this PR for now.
Please feel free to re-open if you're able to prioritize. Thanks!

I've re-added the "Up for Grabs" label on #109

//cc @larkox @mickmister

@lindy65 lindy65 closed this May 27, 2021
@hanzei hanzei added Lifecycle/3:orphaned and removed 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester Lifecycle/1:stale labels May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zoom: Alert the channel when a particpant has joined a meeting before host
7 participants