diff options
author | lain <lain@soykaf.club> | 2020-04-28 16:26:19 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-04-28 16:26:19 +0200 |
commit | 6aa116eca7d6ef6567dcef03b8c776bd2134bf3f (patch) | |
tree | 60d1a53c276f03a01db4a8f095b666f5b9485afe /lib/pleroma/web/common_api/common_api.ex | |
parent | b5dc59c8fa587b4db844c7fc0ba16e5cb00bfd38 (diff) | |
download | pleroma-6aa116eca7d6ef6567dcef03b8c776bd2134bf3f.tar.gz |
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.
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 5eb221668..c39d1cee6 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -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} |