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

Hide link to delete users if they have orders #3139

Merged
merged 1 commit into from
Mar 20, 2019

Conversation

aitbw
Copy link
Contributor

@aitbw aitbw commented Mar 13, 2019

Description

This PR hides the delete button for users that have at least one order associated to their profiles, which aims to serve as a starting point to solve #3126.

Ref: #3138

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)

Copy link
Contributor

@ericsaupe ericsaupe left a comment

Choose a reason for hiding this comment

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

Helpful UX change.

I think in the future we may consider a more complete solution that complies with GDPR requests by removing any PII for a given user extending what is done in solidus_auth_devise https://github.com/solidusio/solidus_auth_devise/blob/master/app/models/spree/user.rb#L10

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

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

I am OK with this until we reach a resolution to #3138, but that should be a priority.

@aitbw aitbw force-pushed the aitbw/avoid-user-destruction branch from 101c9a4 to 2e96c7a Compare March 15, 2019 11:50
@kennyadsl kennyadsl merged commit 7ca285d into solidusio:master Mar 20, 2019
@kennyadsl
Copy link
Member

@aitbw thanks!

@aitbw aitbw deleted the aitbw/avoid-user-destruction branch March 20, 2019 12:06
@@ -89,7 +89,7 @@
<% if can?(:edit, user) %>
<%= link_to_edit user, no_text: true %>
<% end %>
<% if can?(:destroy, user) %>
<% if can?(:destroy, user) && user.orders.count.zero? %>
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the advantage of doing user.orders.count.zero? instead of user.orders.empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

None, but since both snippets generate a SQL query, they're pretty much exchangeable. Your suggestion is less verbose and feels more natural, though.

@aitbw
Copy link
Contributor Author

aitbw commented Mar 28, 2019

Hi @kainio, sorry for the late reply —yes, you're correct; this PR aims to serve as a workaround.

Since the bug reported in #3126 only affects the backend side of Solidus, I think it's safe to assume admins won't be trying to hack their own stores 😸

I personally am working on a proper fix for the aforementioned issue, but we still haven't reached consensus on #3138 —feel free to join the discussion 🙂

@kennyadsl kennyadsl changed the title Don't allow deletion for users with orders Hide link to delete users if they have orders Jul 1, 2019
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.

6 participants