From f3f736afc4b4532ef71d5c6aba42945bd26a7699 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 25 Oct 2018 02:47:55 +0000 Subject: [PATCH] activity: add helper to fetch an activity's parent --- lib/pleroma/activity.ex | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.45.2