Handle MRF rejections of incoming AP activities
This commit is contained in:
parent
54d4ceec5c
commit
1310cdc24f
2 changed files with 19 additions and 0 deletions
|
@ -274,6 +274,9 @@ def create(%{to: to, actor: actor, context: context, object: object} = params, f
|
|||
else
|
||||
{:fake, true, activity} ->
|
||||
{:ok, activity}
|
||||
|
||||
{:error, message} ->
|
||||
{:error, message}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -213,5 +213,21 @@ test "rejects incoming AP docs with incorrect origin" do
|
|||
|
||||
:error = Federator.incoming_ap_doc(params)
|
||||
end
|
||||
|
||||
test "it does not crash if MRF rejects the post" do
|
||||
policies = Pleroma.Config.get([:instance, :rewrite_policy])
|
||||
mrf_keyword_policy = Pleroma.Config.get(:mrf_keyword)
|
||||
Pleroma.Config.put([:mrf_keyword, :reject], ["lain"])
|
||||
Pleroma.Config.put([:instance, :rewrite_policy], Pleroma.Web.ActivityPub.MRF.KeywordPolicy)
|
||||
|
||||
params =
|
||||
File.read!("test/fixtures/mastodon-post-activity.json")
|
||||
|> Poison.decode!()
|
||||
|
||||
assert Federator.incoming_ap_doc(params) == :error
|
||||
|
||||
Pleroma.Config.put([:instance, :rewrite_policy], policies)
|
||||
Pleroma.Config.put(:mrf_keyword, mrf_keyword_policy)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue