From: William Pitcock Date: Thu, 25 Oct 2018 02:47:55 +0000 (+0000) Subject: activity: add helper to fetch an activity's parent X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=f3f736afc4b4532ef71d5c6aba42945bd26a7699;p=akkoma activity: add helper to fetch an activity's parent --- diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index bed96861f..c065f3b6c 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -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