v2 Suggestions: return empty array
This commit is contained in:
parent
0b2119d4a7
commit
7e1caddc58
|
@ -8,7 +8,7 @@ defmodule Pleroma.Web.MastodonAPI.SuggestionController do
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
||||||
plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["read"]} when action == :index)
|
plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["read"]} when action in [:index, :index2])
|
||||||
|
|
||||||
def open_api_operation(action) do
|
def open_api_operation(action) do
|
||||||
operation = String.to_existing_atom("#{action}_operation")
|
operation = String.to_existing_atom("#{action}_operation")
|
||||||
|
@ -26,7 +26,22 @@ def index_operation do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def index2_operation do
|
||||||
|
%OpenApiSpex.Operation{
|
||||||
|
tags: ["Suggestions"],
|
||||||
|
summary: "Follow suggestions (Not implemented)",
|
||||||
|
operationId: "SuggestionController.index2",
|
||||||
|
responses: %{
|
||||||
|
200 => Pleroma.Web.ApiSpec.Helpers.empty_array_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
@doc "GET /api/v1/suggestions"
|
@doc "GET /api/v1/suggestions"
|
||||||
def index(conn, params),
|
def index(conn, params),
|
||||||
do: Pleroma.Web.MastodonAPI.MastodonAPIController.empty_array(conn, params)
|
do: Pleroma.Web.MastodonAPI.MastodonAPIController.empty_array(conn, params)
|
||||||
|
|
||||||
|
@doc "GET /api/v2/suggestions"
|
||||||
|
def index2(conn, params),
|
||||||
|
do: Pleroma.Web.MastodonAPI.MastodonAPIController.empty_array(conn, params)
|
||||||
end
|
end
|
||||||
|
|
|
@ -594,6 +594,8 @@ defmodule Pleroma.Web.Router do
|
||||||
get("/search", SearchController, :search2)
|
get("/search", SearchController, :search2)
|
||||||
|
|
||||||
post("/media", MediaController, :create2)
|
post("/media", MediaController, :create2)
|
||||||
|
|
||||||
|
get("/suggestions", SuggestionController, :index2)
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/api", Pleroma.Web do
|
scope "/api", Pleroma.Web do
|
||||||
|
|
|
@ -15,4 +15,13 @@ test "returns empty result", %{conn: conn} do
|
||||||
|
|
||||||
assert res == []
|
assert res == []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "returns empty result (v2)", %{conn: conn} do
|
||||||
|
res =
|
||||||
|
conn
|
||||||
|
|> get("/api/v2/suggestions")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert res == []
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue