Resolve #4833
This commit is contained in:
parent
5ba8d4949d
commit
23c9f6a6ca
|
@ -1365,6 +1365,8 @@ admin/views/users.vue:
|
||||||
unsilence-confirm: "サイレンスを解除しますか?"
|
unsilence-confirm: "サイレンスを解除しますか?"
|
||||||
update-remote-user: "リモートユーザー情報の更新"
|
update-remote-user: "リモートユーザー情報の更新"
|
||||||
remote-user-updated: "リモートユーザー情報を更新しました"
|
remote-user-updated: "リモートユーザー情報を更新しました"
|
||||||
|
delete-all-files: "すべてのファイルを削除"
|
||||||
|
delete-all-files-confirm: "すべてのファイルを削除しますか?"
|
||||||
users:
|
users:
|
||||||
title: "ユーザー"
|
title: "ユーザー"
|
||||||
sort:
|
sort:
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
<ui-button @click="showUser"><fa :icon="faSearch"/> {{ $t('lookup') }}</ui-button>
|
<ui-button @click="showUser"><fa :icon="faSearch"/> {{ $t('lookup') }}</ui-button>
|
||||||
|
|
||||||
<div class="user" v-if="user">
|
<div class="user" v-if="user">
|
||||||
<x-user :user='user'/>
|
<x-user :user="user"/>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
<ui-button v-if="user.host != null" @click="updateRemoteUser"><fa :icon="faSync"/> {{ $t('update-remote-user') }}</ui-button>
|
||||||
<ui-button @click="resetPassword"><fa :icon="faKey"/> {{ $t('reset-password') }}</ui-button>
|
<ui-button @click="resetPassword"><fa :icon="faKey"/> {{ $t('reset-password') }}</ui-button>
|
||||||
<ui-horizon-group>
|
<ui-horizon-group>
|
||||||
<ui-button @click="silenceUser"><fa :icon="faMicrophoneSlash"/> {{ $t('make-silence') }}</ui-button>
|
<ui-button @click="silenceUser"><fa :icon="faMicrophoneSlash"/> {{ $t('make-silence') }}</ui-button>
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
<ui-button @click="suspendUser" :disabled="suspending"><fa :icon="faSnowflake"/> {{ $t('suspend') }}</ui-button>
|
<ui-button @click="suspendUser" :disabled="suspending"><fa :icon="faSnowflake"/> {{ $t('suspend') }}</ui-button>
|
||||||
<ui-button @click="unsuspendUser" :disabled="unsuspending">{{ $t('unsuspend') }}</ui-button>
|
<ui-button @click="unsuspendUser" :disabled="unsuspending">{{ $t('unsuspend') }}</ui-button>
|
||||||
</ui-horizon-group>
|
</ui-horizon-group>
|
||||||
<ui-button v-if="user.host != null" @click="updateRemoteUser"><fa :icon="faSync"/> {{ $t('update-remote-user') }}</ui-button>
|
<ui-button @click="deleteAllFiles"><fa :icon="faTrashAlt"/> {{ $t('delete-all-files') }}</ui-button>
|
||||||
<ui-textarea v-if="user" :value="user | json5" readonly tall style="margin-top:16px;"></ui-textarea>
|
<ui-textarea v-if="user" :value="user | json5" readonly tall style="margin-top:16px;"></ui-textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,7 +68,7 @@ import Vue from 'vue';
|
||||||
import i18n from '../../i18n';
|
import i18n from '../../i18n';
|
||||||
import parseAcct from "../../../../misc/acct/parse";
|
import parseAcct from "../../../../misc/acct/parse";
|
||||||
import { faUsers, faTerminal, faSearch, faKey, faSync, faMicrophoneSlash } from '@fortawesome/free-solid-svg-icons';
|
import { faUsers, faTerminal, faSearch, faKey, faSync, faMicrophoneSlash } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faSnowflake } from '@fortawesome/free-regular-svg-icons';
|
import { faSnowflake, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
|
||||||
import XUser from './users.user.vue';
|
import XUser from './users.user.vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -88,7 +89,7 @@ export default Vue.extend({
|
||||||
offset: 0,
|
offset: 0,
|
||||||
users: [],
|
users: [],
|
||||||
existMore: false,
|
existMore: false,
|
||||||
faTerminal, faUsers, faSnowflake, faSearch, faKey, faSync, faMicrophoneSlash
|
faTerminal, faUsers, faSnowflake, faSearch, faKey, faSync, faMicrophoneSlash, faTrashAlt
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -277,6 +278,25 @@ export default Vue.extend({
|
||||||
this.refreshUser();
|
this.refreshUser();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async deleteAllFiles() {
|
||||||
|
if (!await this.getConfirmed(this.$t('delete-all-files-confirm'))) return;
|
||||||
|
|
||||||
|
const process = async () => {
|
||||||
|
await this.$root.api('admin/delete-all-files-of-a-user', { userId: this.user.id });
|
||||||
|
this.$root.dialog({
|
||||||
|
type: 'success',
|
||||||
|
splash: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
await process().catch(e => {
|
||||||
|
this.$root.dialog({
|
||||||
|
type: 'error',
|
||||||
|
text: e.toString()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
async getConfirmed(text: string): Promise<Boolean> {
|
async getConfirmed(text: string): Promise<Boolean> {
|
||||||
const confirm = await this.$root.dialog({
|
const confirm = await this.$root.dialog({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
import $ from 'cafy';
|
||||||
|
import define from '../../define';
|
||||||
|
import del from '../../../../services/drive/delete-file';
|
||||||
|
import { DriveFiles } from '../../../../models';
|
||||||
|
import { ID } from '../../../../misc/cafy-id';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ['admin'],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
requireModerator: true,
|
||||||
|
|
||||||
|
params: {
|
||||||
|
userId: {
|
||||||
|
validator: $.type(ID),
|
||||||
|
desc: {
|
||||||
|
'ja-JP': '対象のユーザーID',
|
||||||
|
'en-US': 'The user ID which you want to suspend'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default define(meta, async (ps, me) => {
|
||||||
|
const files = await DriveFiles.find({
|
||||||
|
userId: ps.userId
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
del(file);
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue