Skip to content

Commit

Permalink
公式・プレミアム・ねこ・ボットアカウントを検索可能
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Mar 5, 2023
1 parent d194d89 commit 5b53fc1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,11 @@ admin/views/users.vue:
moderator: "Moderator"
adminOrModerator: "Admin/Moderator"
verified: "Official Account"
premiumed: "Premium Account"
silenced: "Already silenced"
suspended: "Suspended"
bot: "Bot Account"
cat: "Cat Account"
origin:
title: "Origin"
combined: "Local + Remote"
Expand Down
3 changes: 3 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,11 @@ admin/views/users.vue:
moderator: "モデレーター"
adminOrModerator: "管理者+モデレーター"
verified: "公式アカウント"
premiumed: "プレミアムアカウント"
silenced: "サイレンス済み"
suspended: "凍結済み"
bot: "ボットアカウント"
cat: "ねこアカウント"
origin:
title: "オリジン"
combined: "ローカル+リモート"
Expand Down
3 changes: 3 additions & 0 deletions src/client/app/admin/views/users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@
<option value="admin">{{ $t('users.state.admin') }}</option>
<option value="moderator">{{ $t('users.state.moderator') }}</option>
<option value="verified">{{ $t('users.state.verified') }}</option>
<option value="premiumed">{{ $t('users.state.premiumed') }}</option>
<option value="silenced">{{ $t('users.state.silenced') }}</option>
<option value="suspended">{{ $t('users.state.suspended') }}</option>
<option value="cat">{{ $t('users.state.cat') }}</option>
<option value="bot">{{ $t('users.state.bot') }}</option>
</ui-select>
<ui-select v-model="origin">
<template #label>{{ $t('users.origin.title') }}</template>
Expand Down
8 changes: 7 additions & 1 deletion src/server/api/endpoints/admin/show-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ export const meta = {
'admin',
'moderator',
'adminOrModerator',
'verified',
'premiumed',
'silenced',
'suspended',
'cat',
'bot',
]),
default: 'all'
},
Expand Down Expand Up @@ -74,10 +78,12 @@ export default define(meta, async (ps, me) => {
case 'moderator': query.where('user.isModerator = TRUE'); break;
case 'adminOrModerator': query.where('user.isAdmin = TRUE OR isModerator = TRUE'); break;
case 'verified': query.where('user.isVerified = TRUE'); break;
case 'premium': query.where('user.isPremium = TRUE'); break;
case 'premiumed': query.where('user.isPremium = TRUE'); break;
case 'alive': query.where('user.updatedAt > :date', { date: new Date(Date.now() - 1000 * 60 * 60 * 24 * 5) }); break;
case 'silenced': query.where('user.isSilenced = TRUE'); break;
case 'suspended': query.where('user.isSuspended = TRUE'); break;
case 'cat': query.where('user.isCat = TRUE'); break;
case 'bot': query.where('user.isBot = TRUE'); break;
}

switch (ps.origin) {
Expand Down
2 changes: 2 additions & 0 deletions src/server/api/endpoints/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const meta = {
'moderator',
'adminOrModerator',
'verified',
'premiumed',
'alive'
]),
default: 'all'
Expand Down Expand Up @@ -71,6 +72,7 @@ export default define(meta, async (ps, me) => {
case 'moderator': query.where('user.isModerator = TRUE'); break;
case 'adminOrModerator': query.where('user.isAdmin = TRUE OR isModerator = TRUE'); break;
case 'verified': query.where('user.isVerified = TRUE'); break;
case 'premiumed': query.where('user.isPremium = TRUE'); break;
case 'alive': query.where('user.updatedAt > :date', { date: new Date(Date.now() - 1000 * 60 * 60 * 24 * 5) }); break;
}

Expand Down

0 comments on commit 5b53fc1

Please sign in to comment.