diff options
Diffstat (limited to 'lib/pleroma/web/pleroma_api/controllers/account_controller.ex')
-rw-r--r-- | lib/pleroma/web/pleroma_api/controllers/account_controller.ex | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex index 66a8d1c1c..ca6c9c3a2 100644 --- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex @@ -51,6 +51,11 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do when action == :endorsements ) + plug( + OAuthScopesPlug, + %{scopes: ["read:accounts"]} when action == :birthdays + ) + plug(RateLimiter, [name: :account_confirmation_resend] when action == :confirmation_resend) plug( @@ -137,4 +142,18 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do {:error, message} -> json_response(conn, :forbidden, %{error: message}) end end + + @doc "GET /api/v1/pleroma/birthday_reminders" + def birthdays(%{assigns: %{user: %User{} = user}} = conn, %{day: day, month: month} = _params) do + birthdays = + User.Query.build(%{friends: user, deactivated: false, birth_day: day, birth_month: month}) + |> Pleroma.Repo.all() + + conn + |> render("index.json", + for: user, + users: birthdays, + as: :user + ) + end end |