+ defp set_cache_ttl_for(conn, %Activity{object: object}) do
+ set_cache_ttl_for(conn, object)
+ end
+
+ defp set_cache_ttl_for(conn, entity) do
+ ttl =
+ case entity do
+ %Object{data: %{"type" => "Question"}} ->
+ Pleroma.Config.get([:web_cache_ttl, :activity_pub_question])
+
+ %Object{} ->
+ Pleroma.Config.get([:web_cache_ttl, :activity_pub])
+
+ _ ->
+ nil
+ end
+
+ assign(conn, :cache_ttl, ttl)
+ end
+
+ # GET /relay/following
+ def following(%{assigns: %{relay: true}} = conn, _params) do
+ conn
+ |> put_resp_content_type("application/activity+json")
+ |> json(UserView.render("following.json", %{user: Relay.get_actor()}))
+ end
+