diff options
author | Maxim Filippov <colixer@gmail.com> | 2019-07-24 02:42:28 +0300 |
---|---|---|
committer | Maxim Filippov <colixer@gmail.com> | 2019-07-24 02:42:28 +0300 |
commit | f46805bb40bf29cd67acb33b6b65ed1e4e28d3e1 (patch) | |
tree | 7542dbbe178183e4dd3c3451aa7744f18117fa37 /test/support/factory.ex | |
parent | 03471151d6089e318abaf5265d42ffedf7a5b902 (diff) | |
parent | 1a751529fb2cd3929e3373a908bec5db5cc32f1b (diff) | |
download | pleroma-f46805bb40bf29cd67acb33b6b65ed1e4e28d3e1.tar.gz |
Merge branch 'develop' into feature/admin-api-user-statuses
Diffstat (limited to 'test/support/factory.ex')
-rw-r--r-- | test/support/factory.ex | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index d02bd9212..c751546ce 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -118,18 +118,21 @@ defmodule Pleroma.Factory do def note_activity_factory(attrs \\ %{}) do user = attrs[:user] || insert(:user) note = attrs[:note] || insert(:note, user: user) - published = attrs[:published] || DateTime.utc_now() |> DateTime.to_iso8601() - attrs = Map.drop(attrs, [:user, :note]) - data = %{ - "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(), - "type" => "Create", - "actor" => note.data["actor"], - "to" => note.data["to"], - "object" => note.data["id"], - "published" => published, - "context" => note.data["context"] - } + data_attrs = attrs[:data_attrs] || %{} + attrs = Map.drop(attrs, [:user, :note, :data_attrs]) + + data = + %{ + "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(), + "type" => "Create", + "actor" => note.data["actor"], + "to" => note.data["to"], + "object" => note.data["id"], + "published" => DateTime.utc_now() |> DateTime.to_iso8601(), + "context" => note.data["context"] + } + |> Map.merge(data_attrs) %Pleroma.Activity{ data: data, |