Create activity handling: Flip it and reverse it
Both objects and create activities will now go through the common pipeline and will be validated. Objects are now created as a side effect of the Create activity, rolling back a transaction if it's not possible to insert the object.
This commit is contained in:
parent
b5dc59c8fa
commit
6aa116eca7
14 changed files with 155 additions and 52 deletions
|
|
@ -38,13 +38,15 @@ defmodule Pleroma.Web.CommonAPI do
|
|||
recipient.ap_id,
|
||||
content |> Formatter.html_escape("text/plain")
|
||||
)},
|
||||
{_, {:ok, chat_message_object}} <-
|
||||
{:create_object, Object.create(chat_message_data)},
|
||||
{_, {:ok, create_activity_data, _meta}} <-
|
||||
{:build_create_activity,
|
||||
Builder.create(user, chat_message_object.data["id"], [recipient.ap_id])},
|
||||
Builder.create(user, chat_message_data["id"], [recipient.ap_id])},
|
||||
{_, {:ok, %Activity{} = activity, _meta}} <-
|
||||
{:common_pipeline, Pipeline.common_pipeline(create_activity_data, local: true)} do
|
||||
{:common_pipeline,
|
||||
Pipeline.common_pipeline(create_activity_data,
|
||||
local: true,
|
||||
object_data: chat_message_data
|
||||
)} do
|
||||
{:ok, activity}
|
||||
else
|
||||
{:content_length, false} -> {:error, :content_too_long}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue