diff options
author | Mike Verdone <spiral@arcseconds.net> | 2019-07-22 16:46:20 +0200 |
---|---|---|
committer | Mike Verdone <spiral@arcseconds.net> | 2019-07-24 14:45:14 +0200 |
commit | 704960b3c135d2e050308c68f5ccf5d7b7df40f8 (patch) | |
tree | 85c5e602683014b42147dd582113fafff578c4eb /test/support | |
parent | 378f5f0fbe21c2533719fed9afe8313586fda5d5 (diff) | |
download | pleroma-704960b3c135d2e050308c68f5ccf5d7b7df40f8.tar.gz |
Add support for activity expiration to common and Masto API
The "expires_at" parameter accepts an ISO8601-formatted date which
defines when the activity will expire.
At this point the API will not give you any feedback about if your post
will expire or not.
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/factory.ex | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index 7b52b1328..63fe3a66d 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -143,12 +143,14 @@ defmodule Pleroma.Factory do end defp expiration_offset_by_minutes(attrs, minutes) do + scheduled_at = + NaiveDateTime.utc_now() + |> NaiveDateTime.add(:timer.minutes(minutes), :millisecond) + |> NaiveDateTime.truncate(:second) + %Pleroma.ActivityExpiration{} |> Map.merge(attrs) - |> Map.put( - :scheduled_at, - NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(minutes), :millisecond) - ) + |> Map.put(:scheduled_at, scheduled_at) end def expiration_in_the_past_factory(attrs \\ %{}) do |