+ defp add_link_headers(conn, method, activities) do
+ last = List.last(activities)
+ first = List.first(activities)
+ if last do
+ min = last.id
+ max = first.id
+ next_url = mastodon_api_url(Pleroma.Web.Endpoint, method, max_id: min)
+ prev_url = mastodon_api_url(Pleroma.Web.Endpoint, method, since_id: max)
+ conn
+ |> put_resp_header("link", "<#{next_url}>; rel=\"next\", <#{prev_url}>; rel=\"prev\"")
+ else
+ conn
+ end
+ end
+