From 6f4ca7ddf7f70b219ef1223f6343707ff6910f90 Mon Sep 17 00:00:00 2001
From: William Pitcock <nenolod@dereferenced.org>
Date: Mon, 18 Jun 2018 21:20:44 +0000
Subject: [PATCH] ostatus: use Activity.normalize() instead of directly using
 Activity.get_by_ap_id().

---
 lib/pleroma/web/ostatus/activity_representer.ex | 2 +-
 lib/pleroma/web/ostatus/ostatus_controller.ex   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pleroma/web/ostatus/activity_representer.ex b/lib/pleroma/web/ostatus/activity_representer.ex
index 4179d86c9..5d831459b 100644
--- a/lib/pleroma/web/ostatus/activity_representer.ex
+++ b/lib/pleroma/web/ostatus/activity_representer.ex
@@ -246,7 +246,7 @@ def to_simple_form(
     author = if with_author, do: [{:author, UserRepresenter.to_simple_form(user)}], else: []
 
     mentions = (activity.recipients || []) |> get_mentions
-    follow_activity = Activity.get_by_ap_id(follow_activity["id"])
+    follow_activity = Activity.normalize(follow_activity)
 
     [
       {:"activity:object-type", ['http://activitystrea.ms/schema/1.0/activity']},
diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex
index 2f72fdb16..00bffbd5d 100644
--- a/lib/pleroma/web/ostatus/ostatus_controller.ex
+++ b/lib/pleroma/web/ostatus/ostatus_controller.ex
@@ -107,7 +107,7 @@ def object(conn, %{"uuid" => uuid}) do
 
   def activity(conn, %{"uuid" => uuid}) do
     with id <- o_status_url(conn, :activity, uuid),
-         {_, %Activity{} = activity} <- {:activity, Activity.get_by_ap_id(id)},
+         {_, %Activity{} = activity} <- {:activity, Activity.normalize(id)},
          {_, true} <- {:public?, ActivityPub.is_public?(activity)},
          %User{} = user <- User.get_cached_by_ap_id(activity.data["actor"]) do
       case get_format(conn) do