From 77e39e6aae0852df13b9576a081f30da13d7ec5b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 23 Dec 2020 15:06:20 -0600 Subject: [PATCH] Create dir for EmojiStealPolicy automatically --- lib/pleroma/application.ex | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index bd568d858..a1655721a 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -114,6 +114,9 @@ defmodule Pleroma.Application do set_postgres_server_version() + # Requires Config.TransferTask so ConfigDB values are loaded + steal_emoji_policy_setup() + result end @@ -300,4 +303,20 @@ defmodule Pleroma.Application do [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.MediaProxy] |> Enum.each(&ConcurrentLimiter.new(&1, 1, 0)) end + + @spec steal_emoji_policy_setup() :: :ok + def steal_emoji_policy_setup() do + with true <- + Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy in Config.get!([:mrf, :policies]) do + path = + [:instance, :static_dir] + |> Config.get!() + |> Path.join("emoji/steal") + + if !File.exists?(path), do: File.mkdir_p!(path) + else + _ -> + :ok + end + end end