X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fostatus%2Factivity_representer.ex;h=4179d86c9b354adb1501c5de6d3cae3a6a805183;hb=04c584391ccb726a2b4b08dfd82a1ee27f36d31b;hp=2f28c456e941281104d711d03272482036039055;hpb=b3d67750f04d7c72c3e1deeb6df573cbb195146a;p=akkoma diff --git a/lib/pleroma/web/ostatus/activity_representer.ex b/lib/pleroma/web/ostatus/activity_representer.ex index 2f28c456e..4179d86c9 100644 --- a/lib/pleroma/web/ostatus/activity_representer.ex +++ b/lib/pleroma/web/ostatus/activity_representer.ex @@ -1,7 +1,6 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do alias Pleroma.{Activity, User, Object} alias Pleroma.Web.OStatus.UserRepresenter - alias Pleroma.Formatter require Logger defp get_href(id) do @@ -131,7 +130,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do h.(activity.data["object"]["content"] |> String.replace(~r/[\n\r]/, ""))}, {:published, h.(inserted_at)}, {:updated, h.(updated_at)}, - {:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])}, + {:"ostatus:conversation", [ref: h.(activity.data["context"])], + h.(activity.data["context"])}, {:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []} ] ++ summary ++ @@ -162,7 +162,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do # For notes, federate the object id. {:id, h.(activity.data["object"])} ]}, - {:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])}, + {:"ostatus:conversation", [ref: h.(activity.data["context"])], + h.(activity.data["context"])}, {:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []}, {:link, [rel: 'self', type: ['application/atom+xml'], href: h.(activity.data["id"])], []}, {:"thr:in-reply-to", [ref: to_charlist(activity.data["object"])], []} @@ -193,7 +194,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do {:content, [type: 'html'], ['RT #{retweeted_activity.data["object"]["content"]}']}, {:published, h.(inserted_at)}, {:updated, h.(updated_at)}, - {:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])}, + {:"ostatus:conversation", [ref: h.(activity.data["context"])], + h.(activity.data["context"])}, {:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []}, {:link, [rel: 'self', type: ['application/atom+xml'], href: h.(activity.data["id"])], []}, {:"activity:object", retweeted_xml} @@ -230,16 +232,21 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do end # Only undos of follow for now. Will need to get redone once there are more - def to_simple_form(%{data: %{"type" => "Undo"}} = activity, user, with_author) do + def to_simple_form( + %{data: %{"type" => "Undo", "object" => %{"type" => "Follow"} = follow_activity}} = + activity, + user, + with_author + ) do h = fn str -> [to_charlist(str)] end updated_at = activity.data["published"] inserted_at = activity.data["published"] author = if with_author, do: [{:author, UserRepresenter.to_simple_form(user)}], else: [] - follow_activity = Activity.get_by_ap_id(activity.data["object"]) mentions = (activity.recipients || []) |> get_mentions + follow_activity = Activity.get_by_ap_id(follow_activity["id"]) [ {:"activity:object-type", ['http://activitystrea.ms/schema/1.0/activity']},