1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-12-25 07:35:23 +01:00

Merge branch 'fix/with-reject-nil-clause' into 'develop'

Handle MRF rejections of incoming AP activities

Closes #1095

See merge request pleroma/pleroma!1520
This commit is contained in:
kaniini 2019-08-03 18:12:39 +00:00
commit 7319b41e34
2 changed files with 19 additions and 0 deletions

View File

@ -267,6 +267,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
else
{:fake, true, activity} ->
{:ok, activity}
{:error, message} ->
{:error, message}
end
end

View File

@ -229,5 +229,21 @@ defmodule Pleroma.Web.FederatorTest 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