aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-11-09 13:39:44 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-11-09 13:40:39 +0000
commite4971553c74436b7060f410fe6cbd4f7a9c13b80 (patch)
tree6ac868c99eccc9299e8601e104c458c7775bee26
parentdfc26d0fdd0bff8b2571a722fcddb37a757513d9 (diff)
downloadpleroma-e4971553c74436b7060f410fe6cbd4f7a9c13b80.tar.gz
activitypub: utils: use same object type list for mention extraction as insertion
-rw-r--r--lib/pleroma/web/activity_pub/utils.ex6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex
index d438236c7..fac91830a 100644
--- a/lib/pleroma/web/activity_pub/utils.ex
+++ b/lib/pleroma/web/activity_pub/utils.ex
@@ -6,6 +6,8 @@ defmodule Pleroma.Web.ActivityPub.Utils do
import Ecto.Query
require Logger
+ @supported_object_types ["Article", "Note", "Video", "Page"]
+
# Some implementations send the actor URI as the actor field, others send the entire actor object,
# so figure out what the actor's URI is based on what we have.
def get_ap_id(object) do
@@ -95,7 +97,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
"#{Web.base_url()}/#{type}/#{UUID.generate()}"
end
- def get_notified_from_object(%{"type" => type} = object) when type == "Note" do
+ def get_notified_from_object(%{"type" => type} = object) when type in @supported_object_types do
fake_create_activity = %{
"to" => object["to"],
"cc" => object["cc"],
@@ -179,7 +181,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
Inserts a full object if it is contained in an activity.
"""
def insert_full_object(%{"object" => %{"type" => type} = object_data})
- when is_map(object_data) and type in ["Article", "Note", "Video", "Page"] do
+ when is_map(object_data) and type in @supported_object_types do
with {:ok, _} <- Object.create(object_data) do
:ok
end