docbrown/spec
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
..
black_box Routine rubocop fixes (#10237) 2020-09-08 12:06:47 -04:00
decorators Make definition of new user configurable (#12999) 2021-03-23 14:13:06 +07:00
factories Optimize Article.published scope to use an index (#13071) 2021-03-23 13:07:27 -04:00
fixtures ✂️ Remove the approvals gem ✂️ (#12978) 2021-03-19 13:28:06 -07:00
generator Add service generator (#11265) 2020-11-10 09:09:35 +07:00
helpers Re-Add Reporter Email Form to /admin/reports (#13011) [deploy] 2021-03-22 08:19:05 -06:00
initializers Fix regression in Honeybadger.config.exceptions.ignore (#12796) 2021-02-23 19:08:29 +01:00
lib [15-minute fix] Add ThrottledCall to DisplayAdEventsController (#12924) 2021-03-09 09:06:11 +07:00
liquid_tags ✂️ Remove the approvals gem ✂️ (#12978) 2021-03-19 13:28:06 -07:00
mailers Email confirmation to abuse reports (#12557) 2021-02-03 22:59:50 +03:00
models Optimize Article.published scope to use an index (#13071) 2021-03-23 13:07:27 -04:00
policies Prevent banned users from using API (#12730) 2021-02-18 17:56:16 -05:00
queries/admin Add all new functionality for trusted (#10816) 2020-10-15 17:00:49 -04:00
refinements Update data exporter to handle admin send (#10274) 2020-10-26 18:00:56 -04:00
requests Optimize Article.published scope to use an index (#13071) 2021-03-23 13:07:27 -04:00
routing Add mobile push notifications to Forem (#12419) 2021-03-12 14:08:18 -06:00
serializers/search [deploy] Refactor:Remove Reaction Search Code (#10377) 2020-09-23 12:27:50 -05:00
services Destroy user's sponsorships when destroying the user (#13100) 2021-03-23 13:06:52 -05:00
support ✂️ Remove the approvals gem ✂️ (#12978) 2021-03-19 13:28:06 -07:00
system ✂️ Remove the approvals gem ✂️ (#12978) 2021-03-19 13:28:06 -07:00
tasks Refactor:Send Welcome Broadcast Notifications From Sidekiq (#9923) 2020-08-21 12:57:08 -04:00
uploaders Bump carrierwave from 2.1.1 to 2.2.0 (#12802) 2021-02-25 10:53:25 +01:00
view_objects Enable Rubocop 0.89 cops and fix Lint/ violations (#9709) 2020-08-10 16:57:12 +02:00
views ✂️ Remove the approvals gem ✂️ (#12978) 2021-03-19 13:28:06 -07:00
workers [15-minute fix] Add ThrottledCall to DisplayAdEventsController (#12924) 2021-03-09 09:06:11 +07:00
rails_helper.rb Bump rubocop from 1.10.0 to 1.11.0 (#12848) 2021-03-01 14:34:13 +00:00
spec_helper.rb Manually load dotenv in test (#9971) 2020-08-24 20:19:03 +02:00