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

[MKT-575] Prevent accidental deletion in points #310

Merged
merged 2 commits into from
Oct 10, 2023
Merged

[MKT-575] Prevent accidental deletion in points #310

merged 2 commits into from
Oct 10, 2023

Conversation

JuanVqz
Copy link
Member

@JuanVqz JuanVqz commented Oct 6, 2023

Jira Ticket

https://ombulabs.atlassian.net/browse/MKT-575

Fixes #258

Motivation / Context

Prevent accidental deletion in points

QA / Testing Instructions

Delete a project

Screenshots:

Peek 2023-10-06 10-31


I will abide by the code of conduct.

respond_to do |format|
format.html { redirect_to projects_path, notice: "Project was successfully destroyed." }
if @project.title.strip.eql?(params.dig(:project, :title)&.strip)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @JuanVqz , Out of curiosity, why are we stripping here? should it not be exact match?

Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed that sometimes when editing the project title, it left a space at the end of the title. it might be confusing if you don't realize that when deleting a project.
Of course, we could normalize the title when saving it (strip it) and remove it here.

what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not have a strong reason as to why choose 1 approach over the other. So I would say, lets keep what you have already implemented. Thanks for clarifying.

Comment on lines +145 to +149
it "does not delete the project" do
expect {
delete :destroy, params: {id: project.id}
}.not_to change(Project, :count)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @JuanVqz , can we also add a spec for testing that it does not delete when we pass the title of the project but it is not the right title?

Copy link
Contributor

Choose a reason for hiding this comment

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

I have added the spec since it was not something of a big change.

Copy link
Member Author

Choose a reason for hiding this comment

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

@rishijain
Copy link
Contributor

The PR looks good from code review perspective.

@FionaDL FionaDL temporarily deployed to points-mkt-575-83vjueqxgtyqfus October 10, 2023 20:00 Inactive
@FionaDL
Copy link
Member

FionaDL commented Oct 10, 2023

QA looks good!

@FionaDL FionaDL merged commit f6bc154 into main Oct 10, 2023
2 checks passed
@FionaDL FionaDL deleted the MKT-575 branch October 10, 2023 20:14
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.

Prevent accidental deletion of projects like Github does
3 participants