summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2022-06-25 10:03:19 -0400
committerTusooa Zhu <tusooa@kazv.moe>2022-06-25 10:03:19 -0400
commit5321fd001233076e7f2b6ea00adeb41ecf7e180a (patch)
treeaa2e68a6603dbc9f8c45ca09547cce1e629ef2a6 /lib
parent9c6dae942d2ec5e2314af1d345cf2aeed504aae8 (diff)
downloadpleroma-5321fd001233076e7f2b6ea00adeb41ecf7e180a.tar.gz
pleroma-5321fd001233076e7f2b6ea00adeb41ecf7e180a.zip
Do not put meta[:object_data] for local Updates
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/object_validator.ex12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex
index b3105c46e..d4bf9c31e 100644
--- a/lib/pleroma/web/activity_pub/object_validator.ex
+++ b/lib/pleroma/web/activity_pub/object_validator.ex
@@ -146,7 +146,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do
meta
)
when objtype in ~w[Question Answer Audio Video Event Article Note Page] do
- with {:ok, object_data} <- cast_and_apply(object),
+ with {_, false} <- {:local, Access.get(meta, :local, false)},
+ {:ok, object_data} <- cast_and_apply(object),
meta = Keyword.put(meta, :object_data, object_data |> stringify_keys),
{:ok, update_activity} <-
update_activity
@@ -154,6 +155,15 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do
|> Ecto.Changeset.apply_action(:insert) do
update_activity = stringify_keys(update_activity)
{:ok, update_activity, meta}
+ else
+ {:local, _} ->
+ with {:ok, object} <-
+ update_activity
+ |> UpdateValidator.cast_and_validate()
+ |> Ecto.Changeset.apply_action(:insert) do
+ object = stringify_keys(object)
+ {:ok, object, meta}
+ end
end
end