Rename id helper method.
This commit is contained in:
parent
1db0dc3072
commit
dd9bb37893
4 changed files with 9 additions and 19 deletions
|
|
@ -263,11 +263,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
def handle_incoming(
|
||||
%{"type" => "Delete", "object" => object_id, "actor" => actor, "id" => _id} = _data
|
||||
) do
|
||||
object_id =
|
||||
case object_id do
|
||||
%{"id" => id} -> id
|
||||
id -> id
|
||||
end
|
||||
object_id = Utils.get_ap_id(object_id)
|
||||
|
||||
with %User{} = _actor <- User.get_or_fetch_by_ap_id(actor),
|
||||
{:ok, object} <-
|
||||
|
|
@ -365,9 +361,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
end
|
||||
|
||||
# TODO
|
||||
# Accept
|
||||
|
||||
def handle_incoming(_), do: :error
|
||||
|
||||
def get_obj_helper(id) do
|
||||
|
|
|
|||
|
|
@ -7,18 +7,15 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
|
||||
# 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 normalize_actor(actor) do
|
||||
cond do
|
||||
is_binary(actor) ->
|
||||
actor
|
||||
|
||||
is_map(actor) ->
|
||||
actor["id"]
|
||||
def get_ap_id(object) do
|
||||
case object do
|
||||
%{"id" => id} -> id
|
||||
id -> id
|
||||
end
|
||||
end
|
||||
|
||||
def normalize_params(params) do
|
||||
Map.put(params, "actor", normalize_actor(params["actor"]))
|
||||
Map.put(params, "actor", get_ap_id(params["actor"]))
|
||||
end
|
||||
|
||||
def make_json_ld_header do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue