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

Allow to extend user deletion logic #4471

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Jul 26, 2022

Summary

Currently we restrict to delete a user with an exception if
the user has any orders. Some businesses might want to
allow to delete users with incomplete orders.

This allows to override the can_be_deleted? method in the user
class.

Refs #3138

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

  • I have written a thorough PR description.
  • I have kept my commits small and atomic.
  • I have used clear, explanatory commit messages.
  • I have added automated tests to cover my changes.

Currently we restrict to delete a user with an exception if
the user has any orders. Some businesses might want to
allow to delete users with incomplete orders.

This allows to override the can_be_deleted? method in the user
class.

Refs solidusio#3138
@waiting-for-dev
Copy link
Contributor

Thanks, @tvdeyen. Could we have tests for this new behavior? Also, I'm not a fan of having it as an AR callback, but we can revisit it later if we introduce more service objects.

@tvdeyen
Copy link
Member Author

tvdeyen commented Aug 4, 2022

Thanks, @tvdeyen. Could we have tests for this new behavior? Also, I'm not a fan of having it as an AR callback, but we can revisit it later if we introduce more service objects.

There is no change in behavior. It behaves exactly like before. We have tests for this and they are green.

What exactly do you like me to write tests for?

@waiting-for-dev
Copy link
Contributor

Hey, @tvdeyen. I mean, now it's possible to modify the default behavior by overriding the #can_be_deleted? method. We don't have tests for that. It'd be nice to reflect the expectation for users to modify it. WDYT?

@waiting-for-dev
Copy link
Contributor

In hindsight, I'm ok not adding them. We don't need to test every possible way our code can be overridden 🙂

@tvdeyen
Copy link
Member Author

tvdeyen commented Aug 4, 2022

In hindsight, I'm ok not adding them. We don't need to test every possible way our code can be overridden 🙂

Thanks. That's what I thought as well 🙂

@tvdeyen tvdeyen merged commit 521ef3f into solidusio:master Aug 4, 2022
@tvdeyen tvdeyen deleted the allow-to-destroy-user-with-incomplete-orders branch August 4, 2022 19: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.

3 participants