Remove GET /api/v1/announcements/:id

This commit is contained in:
Tusooa Zhu 2022-03-08 19:22:28 -05:00
commit 881179ec72
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
4 changed files with 2 additions and 94 deletions

View file

@ -25,27 +25,6 @@ defmodule Pleroma.Web.ApiSpec.AnnouncementOperation do
}
end
def show_operation do
%Operation{
tags: ["Announcement"],
summary: "Display one announcement",
operationId: "MastodonAPI.AnnouncementController.show",
parameters: [
Operation.parameter(
:id,
:path,
:string,
"announcement id"
)
],
responses: %{
200 => Operation.response("Response", "application/json", Announcement),
403 => Operation.response("Forbidden", "application/json", ApiError),
404 => Operation.response("Not Found", "application/json", ApiError)
}
}
end
def mark_read_operation do
%Operation{
tags: ["Announcement"],

View file

@ -59,22 +59,4 @@ defmodule Pleroma.Web.MastodonAPI.AnnouncementController do
{:error, :not_found}
end
end
@doc "GET /api/v1/announcements/:id"
def show(%{assigns: %{user: user}} = conn, %{id: id} = _params) do
render_announcement_by_id(conn, id, user)
end
def show(conn, %{id: id} = _params) do
render_announcement_by_id(conn, id)
end
def render_announcement_by_id(conn, id, user \\ nil) do
with announcement when not is_nil(announcement) <- Announcement.get_by_id(id) do
render(conn, "show.json", announcement: announcement, user: user)
else
_ ->
{:error, :not_found}
end
end
end

View file

@ -628,7 +628,6 @@ defmodule Pleroma.Web.Router do
get("/directory", DirectoryController, :index)
get("/announcements", AnnouncementController, :index)
get("/announcements/:id", AnnouncementController, :show)
end
scope "/api/v2", Pleroma.Web.MastodonAPI do