docbrown/lib
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
..
data_update_scripts Remove reactions to a user when deleting the user (#15724) 2021-12-10 11:24:23 -06:00
generators Spelling (#15702) 2021-12-07 06:59:10 -07:00
liquid Remove redundant freeze calls (#14596) 2021-08-26 10:01:08 -04:00
omni_auth/strategies Forem passport (cont) (#14759) 2021-09-30 06:47:45 -06:00
sidekiq Abstract DatadogStatsClient to ForemStatsClient (#12304) 2021-01-27 11:25:44 -05:00
sitemap_generator [deploy] Bug Fix:Monkey Patch Sitemap Generator is lib not config (#10113) 2020-08-31 16:12:11 -05:00
slack/notifier/util Fix link_formatter.rb's lints (#13301) 2021-04-07 14:28:58 -04:00
tasks Modify capitalization of default navigation link (#14849) 2021-10-01 09:42:17 -04:00