Merge branch 'develop' into feature/admin-api-user-statuses
This commit is contained in:
commit
f46805bb40
54 changed files with 1540 additions and 377 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue