Add actor_type filter
This commit is contained in:
parent
6b58b4f545
commit
05b6992dd4
2 changed files with 14 additions and 6 deletions
|
@ -110,10 +110,10 @@ export async function fetchUser(id, authHost, token) {
|
|||
})
|
||||
}
|
||||
|
||||
export async function fetchUsers(filters, authHost, token, page = 1) {
|
||||
export async function fetchUsers(filters, actorTypeFilters, authHost, token, page = 1) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
url: `/api/pleroma/admin/users?page=${page}&filters=${filters}`,
|
||||
url: `/api/pleroma/admin/users?page=${page}&filters=${filters}&actor_types=${actorTypeFilters}`,
|
||||
method: 'get',
|
||||
headers: authHeaders(token)
|
||||
})
|
||||
|
@ -175,10 +175,10 @@ export async function resendConfirmationEmail(nicknames, authHost, token) {
|
|||
})
|
||||
}
|
||||
|
||||
export async function searchUsers(query, filters, authHost, token, page = 1) {
|
||||
export async function searchUsers(query, filters, actorTypeFilters, authHost, token, page = 1) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
url: `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`,
|
||||
url: `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}&actor_types=${actorTypeFilters}`,
|
||||
method: 'get',
|
||||
headers: authHeaders(token)
|
||||
})
|
||||
|
|
|
@ -31,6 +31,7 @@ const users = {
|
|||
totalUsersCount: 0,
|
||||
currentPage: 1,
|
||||
pageSize: 50,
|
||||
actorTypeFilters: [],
|
||||
filters: {
|
||||
local: false,
|
||||
external: false,
|
||||
|
@ -46,6 +47,9 @@ const users = {
|
|||
tags: []
|
||||
},
|
||||
mutations: {
|
||||
SET_ACTOR_TYPE_FILTERS: (state, actorTypeFilters) => {
|
||||
state.actorTypeFilters = actorTypeFilters
|
||||
},
|
||||
SET_USERS: (state, users) => {
|
||||
state.fetchedUsers = users
|
||||
},
|
||||
|
@ -248,7 +252,7 @@ const users = {
|
|||
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
|
||||
commit('SET_LOADING', true)
|
||||
const filters = Object.keys(state.filters).filter(filter => state.filters[filter]).join()
|
||||
const response = await fetchUsers(filters, getters.authHost, getters.token, page)
|
||||
const response = await fetchUsers(filters, state.actorTypeFilters, getters.authHost, getters.token, page)
|
||||
await dispatch('GetNodeInfo')
|
||||
loadUsers(commit, page, response.data)
|
||||
},
|
||||
|
@ -299,7 +303,7 @@ const users = {
|
|||
commit('SET_SEARCH_QUERY', query)
|
||||
|
||||
const filters = Object.keys(state.filters).filter(filter => state.filters[filter]).join()
|
||||
const response = await searchUsers(query, filters, getters.authHost, getters.token, page)
|
||||
const response = await searchUsers(query, filters, state.actorTypeFilters, getters.authHost, getters.token, page)
|
||||
|
||||
loadUsers(commit, page, response.data)
|
||||
}
|
||||
|
@ -310,6 +314,10 @@ const users = {
|
|||
duration: 5 * 1000
|
||||
})
|
||||
},
|
||||
async ToggleActorTypeFilter({ commit, dispatch, state }, actorTypeFilters) {
|
||||
commit('SET_ACTOR_TYPE_FILTERS', actorTypeFilters)
|
||||
dispatch('SearchUsers', { query: state.searchQuery, page: 1 })
|
||||
},
|
||||
async ToggleUsersFilter({ commit, dispatch, state }, filters) {
|
||||
const defaultFilters = {
|
||||
local: false,
|
||||
|
|
Loading…
Reference in a new issue