remove validate_expires_at from enqueue method
This commit is contained in:
parent
a098e10fd6
commit
15aece7238
4 changed files with 30 additions and 31 deletions
|
|
@ -155,8 +155,7 @@ defmodule Mix.Tasks.Pleroma.Database do
|
|||
|
||||
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
||||
activity_id: activity.id,
|
||||
expires_at: expires_at,
|
||||
validate: false
|
||||
expires_at: expires_at
|
||||
})
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ defmodule Pleroma.Workers.PurgeExpiredActivity do
|
|||
| {:error, :expired_activities_disabled}
|
||||
| {:error, :expiration_too_close}
|
||||
def enqueue(args) do
|
||||
with true <- enabled?(),
|
||||
args when is_map(args) <- validate_expires_at(args) do
|
||||
with true <- enabled?() do
|
||||
{scheduled_at, args} = Map.pop(args, :expires_at)
|
||||
|
||||
args
|
||||
|
|
@ -42,16 +41,6 @@ defmodule Pleroma.Workers.PurgeExpiredActivity do
|
|||
end
|
||||
end
|
||||
|
||||
defp validate_expires_at(%{validate: false} = args), do: Map.delete(args, :validate)
|
||||
|
||||
defp validate_expires_at(args) do
|
||||
if expires_late_enough?(args[:expires_at]) do
|
||||
args
|
||||
else
|
||||
{:error, :expiration_too_close}
|
||||
end
|
||||
end
|
||||
|
||||
defp find_activity(id) do
|
||||
with nil <- Activity.get_by_id_with_object(id) do
|
||||
{:error, :activity_not_found}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue