docbrown/app
Daniel Uber 421dad2900
Remove reactions to a user when deleting the user (#15724)
* Remove reactions to a user when deleting the user

Fixes #15245

---

I have no idea why `create(:vomit_reaction, reactable: user)` gave a
validation error about category being invalid, but `build().save`
worked fine.

* Move relation details to reaction scope `for_user`

Add a user method to access this by passing self to reaction scope

* Create a moderator when flagging user in factory

This might be a missing requirement in the reactions factory - but
this suppresses an error about invalid category I was getting when
setting a privileged reaction on the user via

    create(:vomit_reaction, reactable: user)

Everywhere else it looks like we do this with `user: moderator` (where
there's a trusted user in the surrounding context).

* Move trusted user requirement into vomit_reaction factory

* Add a data update script to remove reactions to deleted users

This cleans up the remaining invalid references and should make the
change in #15249 obsolete (i.e. we don't need to limit the view to
exclude items that no longer exist).
2021-12-10 11:24:23 -06:00
..
assets Using a Form Object that will persist for the Creator Settings Form (#15684) 2021-12-10 17:07:40 +02:00
black_box Make Rubocop happy again (#14729) 2021-09-14 09:15:01 -05:00
components/admin/users Small change to make the tools section of member details mobile friendly. (#15159) 2021-10-22 18:47:20 +02:00
controllers Using a Form Object that will persist for the Creator Settings Form (#15684) 2021-12-10 17:07:40 +02:00
decorators role deprecation cleanup (#15717) 2021-12-09 15:27:45 -06:00
errors Guarding against spam from OAuth Sources (#15404) 2021-11-18 16:26:39 -05:00
forms Using a Form Object that will persist for the Creator Settings Form (#15684) 2021-12-10 17:07:40 +02:00
helpers Conditionally Renders Links Within the COC During Creator Onboarding (#15692) 2021-12-09 08:17:53 -07:00
javascript Using a Form Object that will persist for the Creator Settings Form (#15684) 2021-12-10 17:07:40 +02:00
lib Spelling (#15702) 2021-12-07 06:59:10 -07:00
liquid_tags Implement Unified Embed for Vimeo URLs (#15699) 2021-12-08 14:21:51 -05:00
mailers ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
models Remove reactions to a user when deleting the user (#15724) 2021-12-10 11:24:23 -06:00
policies ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
queries Renaming constant to reflect intention (#15708) 2021-12-07 16:21:43 -05:00
refinements Drop profile columns from user (#10707) 2020-12-03 08:14:38 +07:00
sanitizers Remove redundant freeze calls (#14596) 2021-08-26 10:01:08 -04:00
serializers ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
services Remove reactions to a user when deleting the user (#15724) 2021-12-10 11:24:23 -06:00
uploaders Creator Settings: Removed SVG files as an option for logo upload (#15662) 2021-12-03 10:47:42 -05:00
validators Spelling (#15702) 2021-12-07 06:59:10 -07:00
view_objects Upgrade to Ruby 3.0.2 (#12103) 2021-08-25 14:26:33 -04:00
views Adjust Creator Settings Form Width (#15725) 2021-12-10 09:53:14 -07:00
workers Use the tag_list method, rather than the cached_tag_list attribute (#15638) 2021-12-03 14:47:42 -06:00