Adminページのユーザー一覧フィルターに利用可能アカウントを追加 (#5430)

* Adminページのユーザー一覧フィルターにアクティブアカウントを追加

* validator update

* availableに
This commit is contained in:
Satsuki Yanagi 2019-09-21 21:35:22 +09:00 committed by syuilo
parent 1b7454ca77
commit 61642539b1
3 changed files with 4 additions and 0 deletions

View file

@ -1547,6 +1547,7 @@ admin/views/users.vue:
state: state:
title: "状態" title: "状態"
all: "すべて" all: "すべて"
available: "利用可能"
admin: "管理者" admin: "管理者"
moderator: "モデレーター" moderator: "モデレーター"
adminOrModerator: "管理者+モデレーター" adminOrModerator: "管理者+モデレーター"

View file

@ -42,6 +42,7 @@
<ui-select v-model="state"> <ui-select v-model="state">
<template #label>{{ $t('users.state.title') }}</template> <template #label>{{ $t('users.state.title') }}</template>
<option value="all">{{ $t('users.state.all') }}</option> <option value="all">{{ $t('users.state.all') }}</option>
<option value="available">{{ $t('users.state.available') }}</option>
<option value="admin">{{ $t('users.state.admin') }}</option> <option value="admin">{{ $t('users.state.admin') }}</option>
<option value="moderator">{{ $t('users.state.moderator') }}</option> <option value="moderator">{{ $t('users.state.moderator') }}</option>
<option value="silenced">{{ $t('users.state.silenced') }}</option> <option value="silenced">{{ $t('users.state.silenced') }}</option>

View file

@ -33,6 +33,7 @@ export const meta = {
state: { state: {
validator: $.optional.str.or([ validator: $.optional.str.or([
'all', 'all',
'available',
'admin', 'admin',
'moderator', 'moderator',
'adminOrModerator', 'adminOrModerator',
@ -67,6 +68,7 @@ export default define(meta, async (ps, me) => {
const query = Users.createQueryBuilder('user'); const query = Users.createQueryBuilder('user');
switch (ps.state) { switch (ps.state) {
case 'available': query.where('user.isSuspended = FALSE'); break;
case 'admin': query.where('user.isAdmin = TRUE'); break; case 'admin': query.where('user.isAdmin = TRUE'); break;
case 'moderator': query.where('user.isModerator = TRUE'); break; case 'moderator': query.where('user.isModerator = TRUE'); break;
case 'adminOrModerator': query.where('user.isAdmin = TRUE OR isModerator = TRUE'); break; case 'adminOrModerator': query.where('user.isAdmin = TRUE OR isModerator = TRUE'); break;