Remove GET /api/v1/announcements/:id
This commit is contained in:
parent
d569694ae9
commit
881179ec72
4 changed files with 2 additions and 94 deletions
|
|
@ -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"],
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue