From fff34e817aea6e92e62148def515f0c0d4d66aaa Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 25 Oct 2020 01:19:14 +0300 Subject: [PATCH] Use actor type filters with search query --- src/api/users.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/api/users.js b/src/api/users.js index 8e61ea30..d45aa701 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -183,9 +183,16 @@ export async function resendConfirmationEmail(nicknames, authHost, token) { } export async function searchUsers(query, filters, actorTypeFilters, authHost, token, page = 1) { + const url = actorTypeFilters.length === 0 + ? `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}` + : actorTypeFilters.reduce((acc, filter) => { + const newAcc = acc.concat(`&actor_types[]=${filter}`) + return newAcc + }, `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`) + return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}&actor_types=${actorTypeFilters}`, + url, method: 'get', headers: authHeaders(token) })