re-add question_activity_factory
This commit is contained in:
parent
0dc333fdb0
commit
7f7669b3db
1 changed files with 27 additions and 0 deletions
|
@ -494,6 +494,33 @@ def report_activity_factory(attrs \\ %{}) do
|
|||
}
|
||||
end
|
||||
|
||||
def question_activity_factory(attrs \\ %{}) do
|
||||
user = attrs[:user] || insert(:user)
|
||||
question = attrs[:question] || insert(:question, user: user)
|
||||
|
||||
data_attrs = attrs[:data_attrs] || %{}
|
||||
attrs = Map.drop(attrs, [:user, :question, :data_attrs])
|
||||
|
||||
data =
|
||||
%{
|
||||
"id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(),
|
||||
"type" => "Create",
|
||||
"actor" => question.data["actor"],
|
||||
"to" => question.data["to"],
|
||||
"object" => question.data["id"],
|
||||
"published" => DateTime.utc_now() |> DateTime.to_iso8601(),
|
||||
"context" => question.data["context"]
|
||||
}
|
||||
|> Map.merge(data_attrs)
|
||||
|
||||
%Pleroma.Activity{
|
||||
data: data,
|
||||
actor: data["actor"],
|
||||
recipients: data["to"]
|
||||
}
|
||||
|> Map.merge(attrs)
|
||||
end
|
||||
|
||||
def delete_activity_factory(attrs \\ %{}) do
|
||||
user = attrs[:user] || insert(:user)
|
||||
note_activity = attrs[:note_activity] || insert(:note_activity, user: user)
|
||||
|
|
Loading…
Reference in a new issue