SideEffects: port ones from ActivityPub.do_create and ActivityPub.insert
This commit is contained in:
parent
4f70fd4105
commit
82895a4012
13 changed files with 188 additions and 73 deletions
|
|
@ -308,18 +308,19 @@ defmodule Pleroma.Web.CommonAPI do
|
|||
{:ok, options, choices} <- normalize_and_validate_choices(choices, object) do
|
||||
answer_activities =
|
||||
Enum.map(choices, fn index ->
|
||||
answer_data = make_answer_data(user, object, Enum.at(options, index)["name"])
|
||||
{:ok, answer_object, _meta} =
|
||||
Builder.answer(user, object, Enum.at(options, index)["name"])
|
||||
|
||||
{:ok, activity} =
|
||||
ActivityPub.create(%{
|
||||
to: answer_data["to"],
|
||||
actor: user,
|
||||
context: object.data["context"],
|
||||
object: answer_data,
|
||||
additional: %{"cc" => answer_data["cc"]}
|
||||
})
|
||||
{:ok, activity_data, _meta} = Builder.create(user, answer_object, [])
|
||||
|
||||
activity
|
||||
{:ok, activity, _meta} =
|
||||
activity_data
|
||||
|> Map.put("cc", answer_object["cc"])
|
||||
|> Map.put("context", answer_object["context"])
|
||||
|> Pipeline.common_pipeline(local: true)
|
||||
|
||||
# TODO: Do preload of Pleroma.Object in Pipeline
|
||||
Activity.normalize(activity.data)
|
||||
end)
|
||||
|
||||
object = Object.get_cached_by_ap_id(object.data["id"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue