activity: add helper to fetch an activity's parent
This commit is contained in:
parent
4b2a586942
commit
f3f736afc4
1 changed files with 6 additions and 0 deletions
|
@ -82,4 +82,10 @@ defmodule Pleroma.Activity do
|
|||
def normalize(obj) when is_map(obj), do: Activity.get_by_ap_id(obj["id"])
|
||||
def normalize(ap_id) when is_binary(ap_id), do: Activity.get_by_ap_id(ap_id)
|
||||
def normalize(_), do: nil
|
||||
|
||||
def get_in_reply_to_activity(%Activity{data: %{"object" => %{"inReplyTo" => ap_id}}}) do
|
||||
get_create_activity_by_object_ap_id(ap_id)
|
||||
end
|
||||
|
||||
def get_in_reply_to_activity(_), do: nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue