From b036a19c213c2b3cc08c64a0d887d36b9386609d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 18 Jun 2018 20:54:59 +0000 Subject: [PATCH] activity: add normalize() to find a complete activity given either URI or partial structure --- lib/pleroma/activity.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index dd6805125..bed96861f 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -78,4 +78,8 @@ defmodule Pleroma.Activity do end def get_create_activity_by_object_ap_id(_), do: nil + + 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 end -- 2.45.2