in_reply_to ->
# XXX: these heuristics should be moved out of MastodonAPI.
with %Object{} = object <- Object.normalize(in_reply_to) do
- Pleroma.Web.MastodonAPI.StatusView.get_visibility(object.data)
+ Pleroma.Web.MastodonAPI.StatusView.get_visibility(object)
end
end
end
end
def bookmark_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do
- with %Activity{} = activity <- Activity.get_by_id(id),
+ with %Activity{} = activity <- Activity.get_by_id_with_object(id),
+ %Object{} = object <- Object.normalize(activity),
%User{} = user <- User.get_by_nickname(user.nickname),
true <- Visibility.visible_for_user?(activity, user),
- {:ok, user} <- User.bookmark(user, activity.data["object"]["id"]) do
+ {:ok, user} <- User.bookmark(user, object.data["id"]) do
conn
|> put_view(StatusView)
|> try_render("status.json", %{activity: activity, for: user, as: :activity})
}
end
- def render("status.json", %{activity: %{data: %{"object" => object}} = activity} = opts) do
- object = Object.normalize(object)
+ def render("status.json", %{activity: %{data: %{"object" => _object}} = activity} = opts) do
+ object = Object.normalize(activity)
user = get_user(activity.data["actor"])
end
end
- def get_reply_to(%{data: %{"object" => object}}, _) do
- object = Object.normalize(object)
+ def get_reply_to(%{data: %{"object" => _object}} = activity, _) do
+ object = Object.normalize(activity)
if object.data["inReplyTo"] && object.data["inReplyTo"] != "" do
Activity.get_create_by_object_ap_id(object.data["inReplyTo"])
capture_log(fn ->
conn =
conn
- |> get("/api/v1/search", %{"q" => activity.data["object"]["id"]})
+ |> get("/api/v1/search", %{"q" => Object.normalize(activity).id})
assert results = json_response(conn, 200)