mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-10 19:11:32 +00:00
Pleroma.Web.MastodonAPI.SearchController: fix dialyzer errors with replace_params: false
This commit is contained in:
parent
324fd08455
commit
fdddba100e
1 changed files with 12 additions and 3 deletions
|
@ -18,7 +18,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
|||
|
||||
@search_limit 40
|
||||
|
||||
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
||||
plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
|
||||
|
||||
# Note: Mastodon doesn't allow unauthenticated access (requires read:accounts / read:search)
|
||||
plug(OAuthScopesPlug, %{scopes: ["read:search"], fallback: :proceed_unauthenticated})
|
||||
|
@ -29,7 +29,11 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
|||
|
||||
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.SearchOperation
|
||||
|
||||
def account_search(%{assigns: %{user: user}} = conn, %{q: query} = params) do
|
||||
def account_search(
|
||||
%{assigns: %{user: user}, private: %{open_api_spex: %{params: %{q: query} = params}}} =
|
||||
conn,
|
||||
_
|
||||
) do
|
||||
accounts = User.search(query, search_options(params, user))
|
||||
|
||||
conn
|
||||
|
@ -44,7 +48,12 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
|||
def search2(conn, params), do: do_search(:v2, conn, params)
|
||||
def search(conn, params), do: do_search(:v1, conn, params)
|
||||
|
||||
defp do_search(version, %{assigns: %{user: user}} = conn, %{q: query} = params) do
|
||||
defp do_search(
|
||||
version,
|
||||
%{assigns: %{user: user}, private: %{open_api_spex: %{params: %{q: query} = params}}} =
|
||||
conn,
|
||||
_
|
||||
) do
|
||||
query = String.trim(query)
|
||||
options = search_options(params, user)
|
||||
timeout = Keyword.get(Repo.config(), :timeout, 15_000)
|
||||
|
|
Loading…
Reference in a new issue