Pleroma.Web.PleromaAPI.NotificationController: fix dialyzer errors with replace_params: false
This commit is contained in:
parent
e157fd60ee
commit
c39e4dd214
|
@ -7,7 +7,7 @@ defmodule Pleroma.Web.PleromaAPI.NotificationController do
|
||||||
|
|
||||||
alias Pleroma.Notification
|
alias Pleroma.Notification
|
||||||
|
|
||||||
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
|
||||||
|
|
||||||
plug(
|
plug(
|
||||||
Pleroma.Web.Plugs.OAuthScopesPlug,
|
Pleroma.Web.Plugs.OAuthScopesPlug,
|
||||||
|
@ -16,7 +16,13 @@ defmodule Pleroma.Web.PleromaAPI.NotificationController do
|
||||||
|
|
||||||
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaNotificationOperation
|
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaNotificationOperation
|
||||||
|
|
||||||
def mark_as_read(%{assigns: %{user: user}, body_params: %{id: notification_id}} = conn, _) do
|
def mark_as_read(
|
||||||
|
%{
|
||||||
|
assigns: %{user: user},
|
||||||
|
private: %{open_api_spex: %{body_params: %{id: notification_id}}}
|
||||||
|
} = conn,
|
||||||
|
_
|
||||||
|
) do
|
||||||
with {:ok, notification} <- Notification.read_one(user, notification_id) do
|
with {:ok, notification} <- Notification.read_one(user, notification_id) do
|
||||||
render(conn, "show.json", notification: notification, for: user)
|
render(conn, "show.json", notification: notification, for: user)
|
||||||
else
|
else
|
||||||
|
@ -27,7 +33,11 @@ def mark_as_read(%{assigns: %{user: user}, body_params: %{id: notification_id}}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def mark_as_read(%{assigns: %{user: user}, body_params: %{max_id: max_id}} = conn, _) do
|
def mark_as_read(
|
||||||
|
%{assigns: %{user: user}, private: %{open_api_spex: %{body_params: %{max_id: max_id}}}} =
|
||||||
|
conn,
|
||||||
|
_
|
||||||
|
) do
|
||||||
notifications =
|
notifications =
|
||||||
user
|
user
|
||||||
|> Notification.set_read_up_to(max_id)
|
|> Notification.set_read_up_to(max_id)
|
||||||
|
|
Loading…
Reference in New Issue