logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

follow_request_controller.ex (1175B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2024 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.PleromaAPI.FollowRequestController do
  5. use Pleroma.Web, :controller
  6. import Pleroma.Web.ControllerHelper,
  7. only: [add_link_headers: 2]
  8. alias Pleroma.Pagination
  9. alias Pleroma.User
  10. alias Pleroma.Web.Plugs.OAuthScopesPlug
  11. plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
  12. action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
  13. plug(OAuthScopesPlug, %{scopes: ["follow", "read:follows"]})
  14. defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaFollowRequestOperation
  15. @doc "GET /api/v1/pleroma/outgoing_follow_requests"
  16. def outgoing(%{assigns: %{user: follower}} = conn, params) do
  17. follow_requests =
  18. follower
  19. |> User.get_outgoing_follow_requests_query()
  20. |> Pagination.fetch_paginated(params, :keyset, :following)
  21. conn
  22. |> put_view(Pleroma.Web.MastodonAPI.FollowRequestView)
  23. |> add_link_headers(follow_requests)
  24. |> render("index.json", for: follower, users: follow_requests, as: :user)
  25. end
  26. end