reject activity creation

if passed expires_at option and expiring activities are not configured
This commit is contained in:
Alexander Strizhakov 2020-09-03 13:30:39 +03:00 committed by rinpatch
commit 93e1c8df9d
3 changed files with 80 additions and 25 deletions

View file

@ -13,6 +13,10 @@ defmodule Pleroma.Workers.PurgeExpiredActivity do
alias Pleroma.Activity
@spec enqueue(map()) ::
{:ok, Oban.Job.t()}
| {: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