Revert "Pleroma.Web.PleromaAPI.NotificationController: dialyzer errors"

This reverts commit 26a95e5787.
This commit is contained in:
Mark Felder 2024-01-30 14:19:32 -05:00
parent 1e76ceacd5
commit 4a80a285d1
2 changed files with 4 additions and 7 deletions

View File

@ -24,11 +24,8 @@ def mark_as_read_operation do
request_body("Parameters", %Schema{ request_body("Parameters", %Schema{
type: :object, type: :object,
properties: %{ properties: %{
"id" => %Schema{type: :integer, description: "A single notification ID to read"}, id: %Schema{type: :integer, description: "A single notification ID to read"},
"max_id" => %Schema{ max_id: %Schema{type: :integer, description: "Read all notifications up to this ID"}
type: :integer,
description: "Read all notifications up to this ID"
}
} }
}), }),
security: [%{"oAuth" => ["write:notifications"]}], security: [%{"oAuth" => ["write:notifications"]}],

View File

@ -16,7 +16,7 @@ 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}, 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 +27,7 @@ def mark_as_read(%{assigns: %{user: user}, body_params: %{"id" => notification_i
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}, 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)