Fix sending actor type filters

This commit is contained in:
Angelina Filippova 2020-10-23 01:04:20 +03:00
parent 80eb0259e2
commit 5dc68eed02
2 changed files with 17 additions and 10 deletions

View file

@ -111,9 +111,16 @@ export async function fetchUser(id, authHost, token) {
} }
export async function fetchUsers(filters, actorTypeFilters, authHost, token, page = 1) { export async function fetchUsers(filters, actorTypeFilters, authHost, token, page = 1) {
const url = actorTypeFilters.length === 0
? `/api/pleroma/admin/users?page=${page}&filters=${filters}`
: actorTypeFilters.reduce((acc, filter) => {
const newAcc = acc.concat(`&actor_types[]=${filter}`)
return newAcc
}, `/api/pleroma/admin/users?page=${page}&filters=${filters}`)
return await request({ return await request({
baseURL: baseName(authHost), baseURL: baseName(authHost),
url: `/api/pleroma/admin/users?page=${page}&filters=${filters}&actor_types=${actorTypeFilters}`, url,
method: 'get', method: 'get',
headers: authHeaders(token) headers: authHeaders(token)
}) })

View file

@ -7,19 +7,19 @@
class="select-field" class="select-field"
@change="toggleFilters"> @change="toggleFilters">
<el-option-group :label="$t('usersFilter.byAccountType')"> <el-option-group :label="$t('usersFilter.byAccountType')">
<el-option value="local">{{ $t('usersFilter.local') }}</el-option> <el-option :label="$t('usersFilter.local')" value="local"/>
<el-option value="external">{{ $t('usersFilter.external') }}</el-option> <el-option :label="$t('usersFilter.external')" value="external"/>
</el-option-group> </el-option-group>
<el-option-group :label="$t('usersFilter.byStatus')"> <el-option-group :label="$t('usersFilter.byStatus')">
<el-option value="active">{{ $t('usersFilter.active') }}</el-option> <el-option :label="$t('usersFilter.active')" value="active"/>
<el-option value="deactivated">{{ $t('usersFilter.deactivated') }}</el-option> <el-option :label="$t('usersFilter.deactivated')" value="deactivated"/>
<el-option value="need_approval">{{ $t('usersFilter.pending') }}</el-option> <el-option :label="$t('usersFilter.pending')" value="need_approval"/>
<el-option value="unconfirmed">{{ $t('usersFilter.unconfirmed') }}</el-option> <el-option :label="$t('usersFilter.unconfirmed')" value="unconfirmed"/>
</el-option-group> </el-option-group>
<el-option-group :label="$t('usersFilter.byActorType')"> <el-option-group :label="$t('usersFilter.byActorType')">
<el-option value="Person">{{ $t('usersFilter.person') }}</el-option> <el-option :label="$t('usersFilter.person')" value="Person"/>
<el-option value="Service">{{ $t('usersFilter.bot') }}</el-option> <el-option :label="$t('usersFilter.bot')" value="Service"/>
<el-option value="Application">{{ $t('usersFilter.application') }}</el-option> <el-option :label="$t('usersFilter.application')" value="Application"/>
</el-option-group> </el-option-group>
</el-select> </el-select>
</template> </template>