diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-12-19 20:45:44 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-12-19 20:45:44 +0700 |
commit | 34d85f8a5473fe0f85e8a8e9e8f58e40b3964ba4 (patch) | |
tree | 46eb1651e24997e2e2f4ef6efc891a77e26ea8a8 /lib/pleroma/web/mastodon_api/controllers | |
parent | 6c39fa20b191f985a2be704089c20acbcfe0035a (diff) | |
download | pleroma-34d85f8a5473fe0f85e8a8e9e8f58e40b3964ba4.tar.gz |
Return 404 if account to filter notifications from is not found
Diffstat (limited to 'lib/pleroma/web/mastodon_api/controllers')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/notification_controller.ex | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex index 16759be6a..f2508aca4 100644 --- a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex @@ -23,6 +23,23 @@ defmodule Pleroma.Web.MastodonAPI.NotificationController do plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug) # GET /api/v1/notifications + def index(conn, %{"account_id" => account_id} = params) do + case Pleroma.User.get_cached_by_id(account_id) do + %{ap_id: account_ap_id} -> + params = + params + |> Map.delete("account_id") + |> Map.put("account_ap_id", account_ap_id) + + index(conn, params) + + _ -> + conn + |> put_status(:not_found) + |> json(%{"error" => "Account is not found"}) + end + end + def index(%{assigns: %{user: user}} = conn, params) do notifications = MastodonAPI.get_notifications(user, params) |