Commit Graph

12 Commits

Author SHA1 Message Date
evazion
c154ce64fc modreports: fix exception when searching by recipient_name. 2022-09-25 15:06:08 -05:00
evazion
34057b25e1 mod actions: record the subject of the mod action.
Add a polymorphic `subject` field that records the subject of the mod
action. The subject is the post, user, comment, artist, etc the mod
action is for.

* The subject for the user ban and unban actions is the user, not the ban itself.
* The subject for the user feedback update and deletion actions is the user,
  not the feedback itself.
* The subject for the post undeletion action is the post, not the approval itself.
* The subject for the move favorites action is the source post where the
  favorites were moved from, not the destination post where the favorites
  were moved to.
* The subject for the post permanent delete action is nil, because the
  post itself is hard deleted.
* When a post is permanently deleted, all mod actions related to the
  post are deleted as well.
2022-09-25 04:04:28 -05:00
evazion
b695c4ccb1 modreports: fix private user information leak in new modreport action.
Fix this:

    https://danbooru.donmai.us/moderation_reports/new.json?moderation_report[model_id]=52664&moderation_report[model_type]=User

raising an `undefined method `reportable?' for #<UserPolicy ...>`
exception, which contained the full user object in the error message,
which leaked private user information.
2022-02-06 14:39:08 -06:00
evazion
5fd0d498a4 modreports: log modaction when report is handled or rejected. 2022-01-20 21:28:29 -06:00
evazion
c8d27c2719 Fix #4669: Track moderation report status.
* Add ability to mark moderation reports as 'handled' or 'rejected'.
* Automatically mark reports as handled when the comment or forum post
  is deleted.
* Send a dmail to the reporter when their report is handled.
* Don't show the report notice on comments or forum posts when all
  reports against it have been handled or rejected.
* Add a fix script to mark all existing reports for deleted comments,
  forum posts, or dmails as handled.
2022-01-20 20:50:23 -06:00
evazion
50a75e2ec5 modreports: allow users to see modreports they've submitted. 2021-01-16 02:19:25 -06:00
BrokenEagle
a903bd95f9 Add tests for all models with includes searches 2020-07-27 19:29:22 +00:00
evazion
9242bf522b pundit: convert moderation reports to pundit. 2020-03-20 18:03:01 -05:00
evazion
3dbdce3ae3 mod reports: fix exception when reporting forum posts. 2020-03-12 21:23:57 -05:00
evazion
e715bfad8a Fix #4278: Certain users are unable to use the report function. 2020-01-30 12:35:05 -06:00
evazion
f2f236c23a mod reports: remove use of belongs_to_creator macro.
Remove use of belongs_to_creator macro as per b4ce2d83a.
2020-01-21 00:25:29 -06:00
BrokenEagle
f3ce811def Add tests for moderation reports
Added an HTML render for the new endpoint to get the tests to work.
It should probably have had one anyways so this is alright.
2020-01-18 23:37:58 +00:00