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-154: Created the settings command to change the preferences for meeting creation #284

Merged
merged 11 commits into from
Oct 27, 2023

Conversation

Nityanand13
Copy link
Contributor

@Nityanand13 Nityanand13 commented Nov 14, 2022

Summary

This PR support /zoom settings command, so user can choose their preferences for creating a meeting. For now, the user will get an ephemeral post on running this command with 3 buttons Yes, No, and Ask.

  1. Yes : Allow the user to use his personal meeting id to start a meeting.
  2. No: Allow the user to use a unique meeting id to start a meeting.
  3. Ask: Ask the user whether he wants to use his personal meeting id or a unique meeting id to start a meeting.

Ticket Link

Issue #154

Nityanand13 and others added 2 commits November 14, 2022 18:06
…olve merge conflicts (#1)

* add  "/zoom setting usePMI" command

* update from 'master' branch

* save usePMI as user preference

* fix error handling in /zoom usePMI setting command

* update from upstream

* create meeting without PMI

* finish feature

* fix lint

* tidy go module

* update tests, optimize code

* tidy the go module

* [MI-1996]: Resolved the bug in use PMI feature of zoom plugin
1. Resolved the problem of  500 internal server error which we were getting on clicking create new meeting when our use PMI was set to ask
2. Added c.apiURL in URL
3. Added auto suggestion for use PMI

* [MI-1996]: Resolved merge conflicts

* [MI-1996]: Resolved the error of make: *** No rule to make target 'webapp/node_modules'. Stop

* [MI-1996]: Removed error of check-style

* [MI-1996]: Resolved the error faced in golangci-lint

* [MI-1996]: Review fixes done
1. Added constants at various places

* [MI-1996]:Review fixes done
1. Added EOF
2. Added Proper comments

* [MI-1996]:Resolved the panic that we were getting on running slash command of zoom plugin

* [MI-1996]: Work in Progress

* [MI-1996]:Added properly with and without PMI feature of zoom plugin

* [MI-1996]: Improved code quality

* [MI-1996]: Fixed CI errors

* [MI-1996]:Review fixes done
1.Improved code quality
2.Added various constants

* [MI-1996]: Review fixes done
1. Improved code quality
2. Changed few names

* [MI-1996]:Review fixes done
1. Improved code quality
2. Improved code readability
3. Resolved gramatical mistakes

* [MI-1996]: Review fixes done
1. Changed few names

* [MI-1996]: Review fixes done
1. Improved code readability
2. Removed indirect dependencies
3. Changed few names

* [MI-1996]: Review fixes done
1. Improved code quality
2. Returned json instead of text

* Fixed CI errors

* [MI-1996]:Review fixes done
1. Improved code quality

Co-authored-by: lantrungseo <[email protected]>
* add  "/zoom setting usePMI" command

* update from 'master' branch

* save usePMI as user preference

* fix error handling in /zoom usePMI setting command

* update from upstream

* create meeting without PMI

* finish feature

* fix lint

* tidy go module

* update tests, optimize code

* tidy the go module

* [MI-1996]: Resolved the bug in use PMI feature of zoom plugin
1. Resolved the problem of  500 internal server error which we were getting on clicking create new meeting when our use PMI was set to ask
2. Added c.apiURL in URL
3. Added auto suggestion for use PMI

* [MI-1996]: Resolved merge conflicts

* [MI-1996]: Resolved the error of make: *** No rule to make target 'webapp/node_modules'. Stop

* [MI-1996]: Removed error of check-style

* [MI-1996]: Resolved the error faced in golangci-lint

* [MI-1996]: Review fixes done
1. Added constants at various places

* [MI-1996]:Review fixes done
1. Added EOF
2. Added Proper comments

* [MI-1996]:Resolved the panic that we were getting on running slash command of zoom plugin

* [MI-1996]: Work in Progress

* [MI-1996]:Added properly with and without PMI feature of zoom plugin

* [MI-1996]: Improved code quality

* [MI-1996]: Fixed CI errors

* [MI-1996]:Review fixes done
1.Improved code quality
2.Added various constants

* [MI-1996]: Review fixes done
1. Improved code quality
2. Changed few names

* [MI-1996]:Review fixes done
1. Improved code quality
2. Improved code readability
3. Resolved gramatical mistakes

* [MI-1996]: Review fixes done
1. Changed few names

* [MI-1996]: Review fixes done
1. Improved code readability
2. Removed indirect dependencies
3. Changed few names

* [MI-1996]: Review fixes done
1. Improved code quality
2. Returned json instead of text

* Fixed CI errors

* [MI-1996]:Review fixes done
1. Improved code quality

* [MI-1996]: Improved code quality

Co-authored-by: lantrungseo <[email protected]>
@Nityanand13 Nityanand13 requested a review from larkox as a code owner November 14, 2022 14:50
@Nityanand13 Nityanand13 changed the title Gh 154 pmi setting command GH-154: Updated the settings command to change your preferences to start a meeting Nov 14, 2022
@Nityanand13 Nityanand13 changed the title GH-154: Updated the settings command to change your preferences to start a meeting GH-154: Created the settings command to change the preferences for meeting creation Nov 14, 2022
@larkox larkox requested a review from mickmister November 15, 2022 13:24
@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Attention: 327 lines in your changes are missing coverage. Please review.

Comparison is base (ecd317a) 23.51% compared to head (dd77223) 19.92%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
- Coverage   23.51%   19.92%   -3.60%     
==========================================
  Files           9        9              
  Lines        1212     1511     +299     
==========================================
+ Hits          285      301      +16     
- Misses        874     1155     +281     
- Partials       53       55       +2     
Files Coverage Δ
server/store.go 11.36% <100.00%> (ø)
server/telemetry.go 33.33% <100.00%> (+10.25%) ⬆️
server/command.go 13.55% <9.61%> (-0.51%) ⬇️
server/http.go 13.26% <6.66%> (-6.74%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nityanand13 Nityanand13 force-pushed the GH-154-PMI-setting-command branch from 4c4a8c8 to 0aadfd9 Compare November 15, 2022 15:23
@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!

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 this improvement @Nityanand13 👍 I have some requests and some questions on the code. Please let me know what you think 👍

plugin.json Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
Comment on lines +151 to +158
api.On("GetPreferencesForUser", mock.AnythingOfType("string")).Return([]model.Preference{
{
UserId: "test-userid",
Category: zoomPreferenceCategory,
Name: zoomPMISettingName,
Value: trueString,
},
}, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Plugins don't usually use the Preferences API to store plugin-level preferences. It's not necessarily a problem, but I want to be consistent with other plugins. I'm really not sure if this is an issue though, @hanzei do you have thoughts on this?

webapp/src/actions/index.js Outdated Show resolved Hide resolved
server/http.go Outdated
}
http.Error(w, err.Error(), http.StatusInternalServerError)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we assume err is not nil here?

Copy link
Contributor Author

@Nityanand13 Nityanand13 Dec 27, 2022

Choose a reason for hiding this comment

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

It will never be nil here, as we are already returning earlier if this err is nil.

Copy link
Contributor

Choose a reason for hiding this comment

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

The code was a bit different when I originally commented on this. The check for the error was inside of a nested if statement, which seemed decoupled from this line.

The control flow is not easy to follow in this function. I think part of the reason for that is we are using several variable names for errors. Are we able to use just one?

Also can we make it so the above block returns when this is an error? Then we can avoid the large if block. I think that would make this easier to read.

server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
server/http.go Show resolved Hide resolved
@mickmister mickmister requested a review from hanzei December 1, 2022 05:36
@hanzei hanzei removed their request for review December 2, 2022 15:03
@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester and removed Lifecycle/1:stale labels Dec 2, 2022
@hanzei
Copy link
Collaborator

hanzei commented Dec 2, 2022

Removing myself as a reviewer until the conversation with @mickmister is wrapped up

@hanzei hanzei linked an issue Dec 2, 2022 that may be closed by this pull request
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.

A few minor questions apart of the changes already proposed.

server/command.go Outdated Show resolved Hide resolved
server/command.go Outdated Show resolved Hide resolved
Nityanand13 added a commit to Brightscout/mattermost-plugin-zoom that referenced this pull request Dec 12, 2022
1. Improved code quality
2. Changed the names of few constants
@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!

Nityanand13 and others added 2 commits December 27, 2022 12:53
* add  "/zoom setting usePMI" command

* update from 'master' branch

* save usePMI as user preference

* fix error handling in /zoom usePMI setting command

* update from upstream

* create meeting without PMI

* finish feature

* fix lint

* tidy go module

* update tests, optimize code

* tidy the go module

* [MI-1996]: Resolved the bug in use PMI feature of zoom plugin
1. Resolved the problem of  500 internal server error which we were getting on clicking create new meeting when our use PMI was set to ask
2. Added c.apiURL in URL
3. Added auto suggestion for use PMI

* [MI-1996]: Resolved merge conflicts

* [MI-1996]: Resolved the error of make: *** No rule to make target 'webapp/node_modules'. Stop

* [MI-1996]: Removed error of check-style

* [MI-1996]: Resolved the error faced in golangci-lint

* [MI-1996]: Review fixes done
1. Added constants at various places

* [MI-1996]:Review fixes done
1. Added EOF
2. Added Proper comments

* [MI-1996]:Resolved the panic that we were getting on running slash command of zoom plugin

* [MI-1996]: Work in Progress

* [MI-1996]:Added properly with and without PMI feature of zoom plugin

* [MI-1996]: Improved code quality

* [MI-1996]: Fixed CI errors

* [MI-1996]:Review fixes done
1.Improved code quality
2.Added various constants

* [MI-1996]: Review fixes done
1. Improved code quality
2. Changed few names

* [MI-1996]:Review fixes done
1. Improved code quality
2. Improved code readability
3. Resolved gramatical mistakes

* [MI-1996]: Review fixes done
1. Changed few names

* [MI-1996]: Review fixes done
1. Improved code readability
2. Removed indirect dependencies
3. Changed few names

* [MI-1996]: Review fixes done
1. Improved code quality
2. Returned json instead of text

* Fixed CI errors

* [MI-1996]:Review fixes done
1. Improved code quality

* [MI-1996]: Improved code quality

* [MI-1996]:Done the review fixes of a PR mattermost#284
1. Improved code quality
2. Changed the names of few constants

* [MI-1996]: Review fixes done
1. Changed few names

* [MI-1996]: Review fixes done
1. Modified error

* [MI-1996]: Review fixes done
1. Changed default topic to topic

* [MI-1996]: Review fixes done
1. Improved code quality

Co-authored-by: lantrungseo <[email protected]>
1.Improved code readability
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.

@Nityanand13 Thanks for addressing the feedback 👍 I have a few more questions and requests

server/http.go Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated
}
http.Error(w, err.Error(), http.StatusInternalServerError)
Copy link
Contributor

Choose a reason for hiding this comment

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

The code was a bit different when I originally commented on this. The check for the error was inside of a nested if statement, which seemed decoupled from this line.

The control flow is not easy to follow in this function. I think part of the reason for that is we are using several variable names for errors. Are we able to use just one?

Also can we make it so the above block returns when this is an error? Then we can avoid the large if block. I think that would make this easier to read.

return response;
}
} catch (err) {
return {err};
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we ever check this err value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
server/http.go Outdated Show resolved Hide resolved
* [MI-2571]: Review fixes done
1. Improved code quality and readability

* [MI-2571]: Review fixes done
1.Improved code quality

* [MI-2571]: Review fixes done
1. Changed status code

* [MI-2571]: Review fixes done
1. Improved code quality
2. Changed few names of variables and functions

* [MI-2571]: Review fixes done
1. Improved code quality
@mickmister
Copy link
Contributor

@Nityanand13 Is this ready for re-review?

@Nityanand13
Copy link
Contributor Author

@Nityanand13 Is this ready for re-review?

yes @mickmister

@hanzei
Copy link
Collaborator

hanzei commented Oct 10, 2023

@Nityanand13 Can you please merge master into your branch?

@hanzei hanzei added the Awaiting Submitter Action Blocked on the author label Oct 16, 2023
@hanzei hanzei removed the request for review from DHaussermann October 16, 2023 20:25
@avas27JTG avas27JTG removed the Awaiting Submitter Action Blocked on the author label Oct 23, 2023
@AayushChaudhary0001
Copy link
Contributor

AayushChaudhary0001 commented Oct 25, 2023

I have tested this PR, but it was found that the response of the question asked in the custom post can be changed at any time, even after the meeting is started.
Also, since there can be multiple customs posts, so the latest generated post may not consist the latest response as it can be changed in the earlier one's.

For example, in the screenshot below, the latest custom post generated has the response as "Ask", whereas the post generated earlier has the updated response as "Yes". So according to the latest post, the Zoom bot should ask the user which mail ID to use, but instead it started the meeting as the latest response stored was "Yes".

image

image

image

Also, this being a ephermal post, the response can not be updated on refreshing the page.

Kindly look into this if we can handle this case also. @mickmister @Kshitij-Katiyar @avas27JTG

In addition, I am also experiencing some UI issues regarding the icons on starting a meet, which needs to be fixed.

image

@mickmister
Copy link
Contributor

@asaadmahmood Would you happen to know why the camera icon is so big the screenshot above? I know you were working with the buttons here recently and I think it's unlikely that it affected that but just wojndering if you have any ideas

@avas27JTG
Copy link
Contributor

avas27JTG commented Oct 26, 2023

@asaadmahmood Would you happen to know why the camera icon is so big the screenshot above? I know you were working with the buttons here recently and I think it's unlikely that it affected that but just wojndering if you have any ideas

@mickmister @asaadmahmood I have fixed it, the issue was due to the change in SVG width and button styling in this PR

@avas27JTG
Copy link
Contributor

I have tested this PR, but it was found that the response of the question asked in the custom post can be changed at any time, even after the meeting is started. Also, since there can be multiple customs posts, so the latest generated post may not consist the latest response as it can be changed in the earlier one's.

For example, in the screenshot below, the latest custom post generated has the response as "Ask", whereas the post generated earlier has the updated response as "Yes". So according to the latest post, the Zoom bot should ask the user which mail ID to use, but instead it started the meeting as the latest response stored was "Yes".

image

image

image

Also, this being a ephermal post, the response can not be updated on refreshing the page.

Kindly look into this if we can handle this case also. @mickmister @Kshitij-Katiyar @avas27JTG

In addition, I am also experiencing some UI issues regarding the icons on starting a meet, which needs to be fixed.

image

@AayushChaudhary0001 both the PMI setting's post issue and zoom video icon have been fixed now.

@asaadmahmood
Copy link
Contributor

@avas27JTG Can you make sure the zoom button still appears like this?
image

@avas27JTG
Copy link
Contributor

@asaadmahmood
image

@asaadmahmood
Copy link
Contributor

Cool, thanks!

Copy link
Contributor

@AayushChaudhary0001 AayushChaudhary0001 left a comment

Choose a reason for hiding this comment

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

Tested and approved
Working fine for the edge case, which was figured out earlier also, LGTM!

@avas27JTG avas27JTG merged commit 598725e into mattermost:master Oct 27, 2023
9 checks passed
@avas27JTG avas27JTG deleted the GH-154-PMI-setting-command branch October 27, 2023 12:42
@hanzei hanzei added 4: Reviews Complete All reviewers have approved the pull request and removed Lifecycle/1:stale 3: QA Review Requires review by a QA tester labels Oct 27, 2023
@hanzei hanzei added this to the v2.0.0 milestone Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decide whether to use PMI or not on instant meetings
10 participants