don't check local objects

This commit is contained in:
Moon Man 2020-03-22 21:41:17 +00:00
parent 0996474508
commit 596bf5882d
1 changed files with 45 additions and 37 deletions

View File

@ -10,8 +10,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
length(result) == 1
end
defp local_actor(actor) do
host = Pleroma.Config.get([Pleroma.Web.Endpoint, :url, :host])
prefix = "https://" <> host <> "/"
String.starts_with?(actor, prefix)
end
@impl true
def filter(%{"object" => %{"emoji" => foreign_emoji}} = object) do
def filter(%{"object" => %{"emoji" => foreign_emoji, "actor" => actor}} = object) do
unless local_actor(actor) do
num_foreign_emoji = Kernel.map_size(foreign_emoji)
if num_foreign_emoji > 0 do
@ -62,6 +69,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
Logger.debug("NO EMOJI TO LOAD")
end
end
end
{:ok, object}
end