diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-08-22 20:46:01 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-09-10 21:50:40 +0300 |
commit | 9bf1065a06837b4c753549d89afe23a636a20972 (patch) | |
tree | 1637cfc658487fd95b89282b87212b9b7f354a83 /lib/pleroma/web/common_api | |
parent | 0254696e30132f48e585154450aff87afb259e1d (diff) | |
download | pleroma-9bf1065a06837b4c753549d89afe23a636a20972.tar.gz |
schedule activity expiration in Oban
Diffstat (limited to 'lib/pleroma/web/common_api')
-rw-r--r-- | lib/pleroma/web/common_api/activity_draft.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/pleroma/web/common_api/activity_draft.ex b/lib/pleroma/web/common_api/activity_draft.ex index f849b2e01..548f76609 100644 --- a/lib/pleroma/web/common_api/activity_draft.ex +++ b/lib/pleroma/web/common_api/activity_draft.ex @@ -202,7 +202,7 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do additional = case draft.expires_at do - %NaiveDateTime{} = expires_at -> Map.put(additional, "expires_at", expires_at) + %DateTime{} = expires_at -> Map.put(additional, "expires_at", expires_at) _ -> additional end diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 4ab533658..500c3883e 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -4,7 +4,6 @@ defmodule Pleroma.Web.CommonAPI do alias Pleroma.Activity - alias Pleroma.ActivityExpiration alias Pleroma.Conversation.Participation alias Pleroma.Formatter alias Pleroma.Object @@ -381,9 +380,9 @@ defmodule Pleroma.Web.CommonAPI do def check_expiry_date({:ok, nil} = res), do: res def check_expiry_date({:ok, in_seconds}) do - expiry = NaiveDateTime.utc_now() |> NaiveDateTime.add(in_seconds) + expiry = DateTime.add(DateTime.utc_now(), in_seconds) - if ActivityExpiration.expires_late_enough?(expiry) do + if Pleroma.Workers.PurgeExpiredActivity.expires_late_enough?(expiry) do {:ok, expiry} else {:error, "Expiry date is too soon"} |