feat: update 'collaborator' command to support read-only permission type#272
Conversation
…geris-release-read-only-app-collabs
|
|
||
| // promptCollaboratorsAddPermissionPrompts gathers the collaborator permission | ||
| // from selection if the experiment allows | ||
| func promptCollaboratorsAddPermissionPrompts( |
There was a problem hiding this comment.
Changed the behaviour here: before when adding a new collaborator we required the permission type to be set, but I think we can default to 'owner' unless otherwise specified
There was a problem hiding this comment.
Sounds good!
Since we're now defaulting to the owner, we should update the description of the --permission-type to default to owner as well. I'll make a suggestion for that!
| slackUser.PermissionType, err = promptCollaboratorPermissionSelection(ctx, clients) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
When updating an existing collaborator however, maybe it would make sense to prompt for the permission type rather than error out
There was a problem hiding this comment.
If we choose to prompt, than we should handle non-TTY (no interactivity) as well. In that case, I think we would error when there is no flag value provided.
suggestion: Personally, I suggest we keep the error when the flag is not provided because it's been tested and works. If we switch to a prompt, I'd rather see it as a separate PR because it changes the functionality rather than simply unhides the experiment (purpose of this PR).
There was a problem hiding this comment.
Sounds good; I'll flip this back to erroring out if the flag isn't provided. I'm fine with keeping that behaviour if the CLI team doesn't see adding the prompt as an enhancement to the user experience
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #272 +/- ##
==========================================
+ Coverage 64.73% 64.85% +0.11%
==========================================
Files 213 213
Lines 17582 17550 -32
==========================================
Hits 11382 11382
+ Misses 5134 5103 -31
+ Partials 1066 1065 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
lukegalbraithrussell
left a comment
There was a problem hiding this comment.
docs changes are good!
mwbrooks
left a comment
There was a problem hiding this comment.
🙇🏻 Thanks for unhiding and releasing the read-only-collaborators experiment!
✏️ The majority of the changes look good.
- I've left 2 suggestions that we should merge to display the
--permission-typedescription consistent with other commands. - I've marked this as Request changes because I don't think we should introduce a prompt for permission types when updating collaborators. I'd a nice UX improvement, but it has a high risk of introducing bugs for non-interactivity environments. I'd rather see this added as a separate PR that we can review, test, and feel confident in.
|
|
||
| // promptCollaboratorsAddPermissionPrompts gathers the collaborator permission | ||
| // from selection if the experiment allows | ||
| func promptCollaboratorsAddPermissionPrompts( |
There was a problem hiding this comment.
Sounds good!
Since we're now defaulting to the owner, we should update the description of the --permission-type to default to owner as well. I'll make a suggestion for that!
| slackUser.PermissionType, err = promptCollaboratorPermissionSelection(ctx, clients) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
If we choose to prompt, than we should handle non-TTY (no interactivity) as well. In that case, I think we would error when there is no flag value provided.
suggestion: Personally, I suggest we keep the error when the flag is not provided because it's been tested and works. If we switch to a prompt, I'd rather see it as a separate PR because it changes the functionality rather than simply unhides the experiment (purpose of this PR).
| response, err := clients.IO.SelectPrompt( | ||
| ctx, | ||
| "Select a permission type", | ||
| permissionLabels, | ||
| iostreams.SelectPromptConfig{ | ||
| Required: true, | ||
| }, | ||
| ) |
There was a problem hiding this comment.
suggestion: I think this needs to be more robust. The iostreams.SelectPromptConfig should be bound to the flag and the flag, so that non-interactive environments can work properly with the prompt.
There was a problem hiding this comment.
Removed the prompt for now but will make note of this if we want to bring it back
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
| case "reader": | ||
| return READER, nil | ||
| default: | ||
| return "", fmt.Errorf("invalid") |
There was a problem hiding this comment.
Updated this error message to be more specific
Summary
A while back we added support for setting some app collaborators as read-only for deployed apps but never released the experiment
Requirements