mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 23:11:13 +00:00
activitypub: utils: use same object type list for mention extraction as insertion
This commit is contained in:
parent
dfc26d0fdd
commit
e4971553c7
|
@ -6,6 +6,8 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
require Logger
|
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,
|
# 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.
|
# so figure out what the actor's URI is based on what we have.
|
||||||
def get_ap_id(object) do
|
def get_ap_id(object) do
|
||||||
|
@ -95,7 +97,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
"#{Web.base_url()}/#{type}/#{UUID.generate()}"
|
"#{Web.base_url()}/#{type}/#{UUID.generate()}"
|
||||||
end
|
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 = %{
|
fake_create_activity = %{
|
||||||
"to" => object["to"],
|
"to" => object["to"],
|
||||||
"cc" => object["cc"],
|
"cc" => object["cc"],
|
||||||
|
@ -179,7 +181,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
Inserts a full object if it is contained in an activity.
|
Inserts a full object if it is contained in an activity.
|
||||||
"""
|
"""
|
||||||
def insert_full_object(%{"object" => %{"type" => type} = object_data})
|
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
|
with {:ok, _} <- Object.create(object_data) do
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue