-
Notifications
You must be signed in to change notification settings - Fork 67
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-133] Added a feature of restricting bot messages to private channels and DM/GMs #337
base: master
Are you sure you want to change the base?
Conversation
…channels and DM/GMs
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #337 +/- ##
==========================================
- Coverage 18.04% 16.56% -1.49%
==========================================
Files 9 9
Lines 1546 1733 +187
==========================================
+ Hits 279 287 +8
- Misses 1216 1407 +191
+ Partials 51 39 -12 ☔ View full report in Codecov by Sentry. |
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.
Can you add testcases for this new feature
@ayusht2810 Please resolve conflicts |
@mickmister Gentle reminder for review |
@mickmister Gentle reminder to review the PR |
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.
LGTM 👍 just some non-blocking comments for discussion
For the markdown table in the channel-settings list
response, we should probably have it say:
Default: Allow meetings in public channels, private channels, and DMs/GMs
or
Default: Allow meetings only in private channels and DMs/GMs
then simply omit any rows from the table that have the "default" value. We could probably just remove that channel from the saved settings map if the user chooses "default". 0/5 on this though
@@ -253,6 +271,10 @@ func (p *Plugin) runDisconnectCommand(user *model.User) (string, error) { | |||
// runHelpCommand runs command to display help text. | |||
func (p *Plugin) runHelpCommand(user *model.User) (string, error) { | |||
text := starterText + strings.ReplaceAll(helpText+"\n"+settingHelpText, "|", "`") | |||
if p.API.HasPermissionTo(user.Id, model.PermissionManageSystem) { |
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.
Nit to use p.client
instead of p.API
. I wonder if we can make a golint rule for this. It doesn't make a huge difference, but it helps with references to AppError
and error
to avoid weird concrete vs interface things there. This HasPermissionTo
method returns only a boolean so it's not any difference here
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.
We can make a seperate for adding golint rule for not using p.API since it will include a lot changes through the code once the new lint rule is implemented
server/http.go
Outdated
} | ||
|
||
zoomChannelSettingsMapValue := ZoomChannelSettingsMapValue{ | ||
ChannelName: submitRequest.CallbackId, |
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.
We're using the display name so probably best to put that here. A little unfortunate that this will become stale if the channel's display name changes. Maybe we should use channel.Name
instead, which is generally more permanent? The user can change both values, but it's more likely that a display name gets changed. Storing it with the channel id below makes sense. I would expect the channel id to be in the struct as well, but it's obviously not required since the feature currently works without that
ChannelName: submitRequest.CallbackId, | |
ChannelDisplayName: submitRequest.CallbackId, |
server/http.go
Outdated
@@ -915,3 +984,45 @@ func (p *Plugin) slackAttachmentToUpdatePMI(currentValue, channelID string) *mod | |||
|
|||
return &slackAttachment | |||
} | |||
|
|||
func (p *Plugin) checkChannelPreference(channelID string) (bool, int, error) { |
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.
func (p *Plugin) checkChannelPreference(channelID string) (bool, int, error) { | |
func (p *Plugin) isChannelRestrictedForMeetings(channelID string) (bool, int, error) { |
Not sure why we need the http status code to be returned from here?
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.
Returning statusCode
for any error that arises so we can return the respective error.
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.
Right but the only values returned are http.StatusInternalServerError
and http.StatusOK
, which can instead be inferred by the caller if an error happened or not
@mickmister |
@Kshitij-Katiyar Yes I was suggesting we display this value in the response in the wording I posted above. Just so when someone wants to inspect the settings on a channel, they can know what the default value is. Then we can omit any channels that are either unassigned or using the default value |
this was the existing channel setting list And this is the updated channel setting list @mickmister I hope this aligns with your suggestions. Please let us know if anything else is required. |
@fmartingr Gentle reminder for review |
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.
Apologies for the delay, just a nit about the help text.
server/http.go
Outdated
@@ -915,3 +984,45 @@ func (p *Plugin) slackAttachmentToUpdatePMI(currentValue, channelID string) *mod | |||
|
|||
return &slackAttachment | |||
} | |||
|
|||
func (p *Plugin) checkChannelPreference(channelID string) (bool, int, error) { |
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.
Right but the only values returned are http.StatusInternalServerError
and http.StatusOK
, which can instead be inferred by the caller if an error happened or not
1. Removed unused params from function 2. Update constant name 3. Remove status code from values
@mickmister Fixed the review comments added by you |
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.
LGTM, just one request to remove the two bin
files
bin/golangci-lint
Outdated
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.
This and bin/gotestsum
should be deleted I think
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.
@mickmister Removed
Summary
Ticket Link
#79
Screenshots
What to test?
settings
slash command when posting meeting links is restricted.