From: William Pitcock Date: Mon, 18 Jun 2018 20:54:59 +0000 (+0000) Subject: activity: add normalize() to find a complete activity given either URI or partial... X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=b036a19c213c2b3cc08c64a0d887d36b9386609d;p=akkoma activity: add normalize() to find a complete activity given either URI or partial structure --- 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