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

feat: default confirm to no for safety #2919

Merged
merged 2 commits into from Jul 12, 2022

Conversation

AbhineetJain
Copy link
Contributor

@AbhineetJain AbhineetJain commented Jul 11, 2022

This PR sets the default confirmation to no for the following cases:

  • Deleting a template
  • Deleting a workspace

Subtasks

  • render yes/no as bolded for default choice
  • update default choice for the two cases mentioned above
  • refactor other code to use the new yes/no constants

Fixes #2878

Screenshot

Screen Shot 2022-07-11 at 3 29 24 PM

@AbhineetJain AbhineetJain requested a review from Jul 11, 2022
cli/logout.go Outdated
@@ -28,7 +28,7 @@ func logout() *cobra.Command {
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
Text: "Are you sure you want to log out?",
IsConfirm: true,
Default: "yes",
Default: "no",
Copy link
Member

@Emyrk Emyrk Jul 11, 2022

Choose a reason for hiding this comment

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

Should we make yes/no a constant?

Copy link
Contributor Author

@AbhineetJain AbhineetJain Jul 11, 2022

Choose a reason for hiding this comment

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

Yes, sounds like a good idea.

@@ -74,7 +71,7 @@ func createUserStatusCommand(sdkStatus codersdk.UserStatus) *cobra.Command {
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
Text: fmt.Sprintf("Are you sure you want to %s this user?", verb),
IsConfirm: true,
Default: defaultConfirm,
Default: cliui.ConfirmYes,
Copy link
Member

@dwahler dwahler Jul 11, 2022

Choose a reason for hiding this comment

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

Looks like this changes the default back to "yes" when suspending a user, was that intentional?

Copy link
Contributor Author

@AbhineetJain AbhineetJain Jul 11, 2022

Choose a reason for hiding this comment

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

Yes, as per the discussion on the issue, the requirements were updated. We want to default to no only in case of deleting templates and workspaces -- the non-reversible kind of deletions.

Copy link
Member

@dwahler dwahler Jul 11, 2022

Choose a reason for hiding this comment

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

Ah, got it, I just missed seeing your edit on the PR description. LGTM!

@AbhineetJain AbhineetJain requested a review from Emyrk Jul 12, 2022
@AbhineetJain AbhineetJain merged commit 61c52b3 into main Jul 12, 2022
15 checks passed
@AbhineetJain AbhineetJain deleted the abhineetjain/2878-confirm-default-no branch Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants