Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: have user type name of thing to delete for extra safety #4080

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

Merged
merged 12 commits into from
Sep 20, 2022

Conversation

presleyp
Copy link
Contributor

Closes #3384

@bpmct
Copy link
Member

bpmct commented Sep 19, 2022

this PR title made me smile, idk why :D

@presleyp presleyp marked this pull request as ready for review September 20, 2022 20:28
@presleyp presleyp requested a review from a team as a code owner September 20, 2022 20:28
@presleyp presleyp requested review from code-asher and BrunoQuaresma and removed request for a team and code-asher September 20, 2022 20:28
})

it("disables confirm button when the text field is filled incorrectly", async () => {
const { t } = i18next
Copy link
Member

Choose a reason for hiding this comment

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

❤️

<Maybe condition={info !== undefined}>
<Typography className={styles.warning}>{info}</Typography>
</Maybe>
<Typography>{t("deleteDialog.confirm", { entity })}</Typography>
Copy link
Member

Choose a reason for hiding this comment

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

I love how we're not passing whole strings in so that the language will stay consistent.

title,
description,
entity,
info,
Copy link
Member

Choose a reason for hiding this comment

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

What kind of info is this? A description?

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, it's intended to help the user identify the entity to delete, so they don't delete the wrong one by accident. @bpmct suggested this on the basis of an article about making the wrong repo private and thus losing all their github stars.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the orange text here. Note storybook isn't showing buttons; that's been going on for a while and so far doesn't mean the buttons are actually gone.
Screen Shot 2022-09-20 at 4 52 28 PM

fireEvent.click(moreButton)
const moreButtons = await screen.findAllByLabelText("more")
const suspendedMoreButton = moreButtons[2]
fireEvent.click(suspendedMoreButton)
Copy link
Member

Choose a reason for hiding this comment

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

Curious why we're using a fireEvent instead of an await user.click like above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be fine to do so - I just didn't make as many changes in this test. I wanted to switch to getting the "more" buttons everywhere because they load later than users, but the userEvent change was more of a hygiene thing than a cause of bugs.

Copy link
Member

Choose a reason for hiding this comment

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

Got it! Thanks

Copy link
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

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

This was satisfying to review!!! Thanks for doing it.

@presleyp presleyp merged commit 0899548 into main Sep 20, 2022
@presleyp presleyp deleted the presleyp/destructive-dialog branch September 20, 2022 21:13
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.

Require that user input object name in destructive actions
3 participants