From 1aa4994f6d867e5c3e0d56dc26d7ebad7e4ecb56 Mon Sep 17 00:00:00 2001
From: Mark Felder <feld@FreeBSD.org>
Date: Thu, 18 Apr 2019 12:44:25 -0500
Subject: [PATCH] Do not require authentication for user search in MastoAPI

---
 docs/api/differences_in_mastoapi_responses.md | 6 ++++++
 lib/pleroma/web/router.ex                     | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/docs/api/differences_in_mastoapi_responses.md b/docs/api/differences_in_mastoapi_responses.md
index 923d94db2..ed3fd9b67 100644
--- a/docs/api/differences_in_mastoapi_responses.md
+++ b/docs/api/differences_in_mastoapi_responses.md
@@ -41,6 +41,12 @@ Has these additional fields under the `pleroma` object:
 - `is_admin`: boolean, true if user is an admin
 - `confirmation_pending`: boolean, true if a new user account is waiting on email confirmation to be activated
 
+## Account Search
+
+Behavior has changed:
+
+- `/api/v1/accounts/search`: Does not require authentication
+
 ## Notifications
 
 Has these additional fields under the `pleroma` object:
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex
index a809347be..8b665d61b 100644
--- a/lib/pleroma/web/router.ex
+++ b/lib/pleroma/web/router.ex
@@ -242,7 +242,6 @@ defmodule Pleroma.Web.Router do
       get("/accounts/verify_credentials", MastodonAPIController, :verify_credentials)
 
       get("/accounts/relationships", MastodonAPIController, :relationships)
-      get("/accounts/search", MastodonAPIController, :account_search)
 
       get("/accounts/:id/lists", MastodonAPIController, :account_lists)
       get("/accounts/:id/identity_proofs", MastodonAPIController, :empty_array)
@@ -377,6 +376,8 @@ defmodule Pleroma.Web.Router do
 
     get("/trends", MastodonAPIController, :empty_array)
 
+    get("/accounts/search", MastodonAPIController, :account_search)
+
     scope [] do
       pipe_through(:oauth_read_or_unauthenticated)
 
-- 
2.49.0