docbrown/app
Daniel Uber 7c45df1d81
Destroy user's sponsorships when destroying the user (#13100)
* Add a failing test

This is failing because sponsorships are not removed by Users::Delete,
and raises a foreign key constraint error because user.destroy tries
to remove a referenced user.

* When destroying a user, destroy associated sponsorships

There is a `belongs_to` relationship in sponsorships, and a has_many
relationship in Organization, this adds a mirror relation on User with
the equivalent dependent destroy rules.

If an organization is removed, all sponsorships belonging to that
organization are removed too, and now, if a user is removed, all
sponsorships created by that user are removed.

Co-authored-by: djuber <djuber@forem.beta-reduction.com>
2021-03-23 13:06:52 -05:00
..
assets Ensure user data is unset if no user is logged in (#13024) 2021-03-23 07:36:49 -05:00
black_box
controllers Make definition of new user configurable (#12999) 2021-03-23 14:13:06 +07:00
decorators Make definition of new user configurable (#12999) 2021-03-23 14:13:06 +07:00
errors Prevent suspended users from self-deleting and returning (#12503) 2021-02-11 09:28:59 +07:00
helpers Make definition of new user configurable (#12999) 2021-03-23 14:13:06 +07:00
javascript RFC#50-P4: Feature Flagged Routes and Interaction Design (#12967) 2021-03-23 11:12:54 +02:00
lib RFC#50-P4: Feature Flagged Routes and Interaction Design (#12967) 2021-03-23 11:12:54 +02:00
liquid_tags improve keyboard accessibility of modals 12427 10610 (#12511) 2021-02-24 16:01:10 +00:00
mailers
middlewares
models Destroy user's sponsorships when destroying the user (#13100) 2021-03-23 13:06:52 -05:00
policies Prevent banned users from using API (#12730) 2021-02-18 17:56:16 -05:00
queries/admin
refinements
sanitizers
serializers Use serializer over as_json (#13029) 2021-03-19 11:16:52 -04:00
services Make definition of new user configurable (#12999) 2021-03-23 14:13:06 +07:00
uploaders Bump carrierwave from 2.1.1 to 2.2.0 (#12802) 2021-02-25 10:53:25 +01:00
validators
view_objects
views RFC#50-P4: Feature Flagged Routes and Interaction Design (#12967) 2021-03-23 11:12:54 +02:00
workers reenable article rescoring when moderators flag users (#12983) 2021-03-16 14:04:13 -05:00