Fix MRF policies to also work with Update
authorilja <git@ilja.space>
Thu, 8 Dec 2022 22:12:27 +0000 (23:12 +0100)
committerilja <git@ilja.space>
Thu, 8 Dec 2022 22:22:05 +0000 (23:22 +0100)
commit1f863f0a36ebb0648c3d39ecb7ea9e3d01deab60
tree0f34999391c2f5f6565fec5f5a462788b7f85304
parentce517ff4e5a9cc144853ec8112bfac2a38a3a68a
Fix MRF policies to also work with Update

Objects who got updated would just pass through several of the MRF policies, undoing moderation in some situations.
In the relevant cases we now check not only for Create activities, but also Update activities.

I checked which ones checked explicitly on type Create using `grep '"type" => "Create"' lib/pleroma/web/activity_pub/mrf/*`.

The following from that list have not been changed:
* lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex
    * Not relevant for moderation
* lib/pleroma/web/activity_pub/mrf/keyword_policy.ex
    * Already had a test for Update
* lib/pleroma/web/activity_pub/mrf/object_age_policy.ex
    * In practice only relevant when fetching old objects (e.g. through Like or Announce). These are always wrapped in a Create.
* lib/pleroma/web/activity_pub/mrf/reject_non_public.ex
    * We don't allow changing scope with Update, so not relevant here
13 files changed:
lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex
lib/pleroma/web/activity_pub/mrf/anti_link_spam_policy.ex
lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
lib/pleroma/web/activity_pub/mrf/mention_policy.ex
lib/pleroma/web/activity_pub/mrf/simple_policy.ex
lib/pleroma/web/activity_pub/mrf/tag_policy.ex
test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs
test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs
test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs
test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs
test/pleroma/web/activity_pub/mrf/mention_policy_test.exs
test/pleroma/web/activity_pub/mrf/simple_policy_test.exs