Use cond & better non-matching clause handling
This commit is contained in:
@@ -6,19 +6,19 @@ defmodule Pleroma.Web.ActivityPub.MRF.ExNihiloNihilFit do
|
||||
defp check_avatar_rewrite(actor, object) do
|
||||
actor_info = URI.parse(actor)
|
||||
|
||||
if actor_info.host in ["youjo.love", "lolison.top", "lolison.network", "rapemeat.solutions", "ghetti.monster"] do
|
||||
object = Map.put(object, "icon", %{"type" => "Image", "url" => "https://ryona.agency/media/ca97357084c09219ce06457594af4a2054a97f5b52b4dde424aacdd988dc59a5.png"})
|
||||
end
|
||||
cond do
|
||||
actor_info.host in ["youjo.love", "lolison.top", "lolison.network", "rapemeat.solutions", "ghetti.monster"] ->
|
||||
{:ok, Map.put(object, "icon", %{"type" => "Image", "url" => "https://ryona.agency/media/ca97357084c09219ce06457594af4a2054a97f5b52b4dde424aacdd988dc59a5.png"})}
|
||||
|
||||
if actor in ["https://rot.gives/users/prouddegenerate", "https://rot.gives/users/Dagashi"] do
|
||||
object = Map.put(object, "icon", %{"type" => "Image", "url" => "https://ryona.agency/media/ca97357084c09219ce06457594af4a2054a97f5b52b4dde424aacdd988dc59a5.png"})
|
||||
end
|
||||
actor in ["https://rot.gives/users/prouddegenerate", "https://rot.gives/users/Dagashi"] ->
|
||||
{:ok, Map.put(object, "icon", %{"type" => "Image", "url" => "https://ryona.agency/media/ca97357084c09219ce06457594af4a2054a97f5b52b4dde424aacdd988dc59a5.png"})}
|
||||
|
||||
if actor in ["https://poa.st/users/graf", "https://khajiit.tech/users/graf"] do
|
||||
object = Map.put(object, "icon", %{"type" => "Image", "url" => "https://ryona.agency/media/3a49fe5681e1311b5cf9c0c81b698c090321a59605baa2a09fff818237970b8d.png"})
|
||||
end
|
||||
actor in ["https://poa.st/users/graf", "https://khajiit.tech/users/graf"] ->
|
||||
{:ok, Map.put(object, "icon", %{"type" => "Image", "url" => "https://ryona.agency/media/3a49fe5681e1311b5cf9c0c81b698c090321a59605baa2a09fff818237970b8d.png"})}
|
||||
|
||||
{:ok, object}
|
||||
true ->
|
||||
{:ok, object}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
@@ -54,13 +54,6 @@ defmodule Pleroma.Web.ActivityPub.MRF.ExNihiloNihilFit do
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def filter(%{"actor" => actor} = object) do
|
||||
with {:ok, object} <- check_avatar_rewrite(actor, object) do
|
||||
{:ok, object}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def filter(%{"id" => actor, "type" => obj_type} = object)
|
||||
when obj_type in ["Application", "Group", "Organization", "Person", "Service"] do
|
||||
@@ -69,6 +62,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.ExNihiloNihilFit do
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def filter(object) do
|
||||
{:ok, object}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def describe, do: {:ok, %{}}
|
||||
end
|
||||
|
||||
@@ -19,16 +19,16 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaRemovalPerActor do
|
||||
end
|
||||
|
||||
@impl true
|
||||
def filter(%{"actor" => actor} = object) do
|
||||
with {:ok, object} <- check_media_removal(actor, object) do
|
||||
def filter(%{"id" => actor, "type" => obj_type} = object)
|
||||
when obj_type in ["Application", "Group", "Organization", "Person", "Service"] do
|
||||
with {:ok, object} <- check_profile_media_removal(actor, object) do
|
||||
{:ok, object}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def filter(%{"id" => actor, "type" => obj_type} = object)
|
||||
when obj_type in ["Application", "Group", "Organization", "Person", "Service"] do
|
||||
with {:ok, object} <- check_profile_media_removal(actor, object) do
|
||||
def filter(%{"actor" => actor} = object) do
|
||||
with {:ok, object} <- check_media_removal(actor, object) do
|
||||
{:ok, object}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user