モデレーション周りのv11の機能復元 (#6249)
* モデレーション周りのv11の機能復元 * i18n * wip * wip Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
parent
11cc9cbc7c
commit
63225ed0fd
10 changed files with 409 additions and 149 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import { faAt, faListUl, faEye, faEyeSlash, faBan, faPencilAlt, faComments, faUsers } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faAt, faListUl, faEye, faEyeSlash, faBan, faPencilAlt, faComments, faUsers, faMicrophoneSlash } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faSnowflake, faEnvelope } from '@fortawesome/free-regular-svg-icons';
|
||||
import i18n from '../i18n';
|
||||
import XMenu from './menu.vue';
|
||||
|
@ -60,8 +60,12 @@ export default Vue.extend({
|
|||
action: this.toggleBlock
|
||||
}]);
|
||||
|
||||
if (this.$store.state.i.isAdmin) {
|
||||
if (this.$store.getters.isSignedIn && (this.$store.state.i.isAdmin || this.$store.state.i.isModerator)) {
|
||||
menu = menu.concat([null, {
|
||||
icon: faMicrophoneSlash,
|
||||
text: this.user.isSilenced ? this.$t('unsilence') : this.$t('silence'),
|
||||
action: this.toggleSilence
|
||||
}, {
|
||||
icon: faSnowflake,
|
||||
text: this.user.isSuspended ? this.$t('unsuspend') : this.$t('suspend'),
|
||||
action: this.toggleSuspend
|
||||
|
@ -194,6 +198,25 @@ export default Vue.extend({
|
|||
});
|
||||
},
|
||||
|
||||
async toggleSilence() {
|
||||
if (!await this.getConfirmed(this.$t(this.user.isSilenced ? 'unsilenceConfirm' : 'silenceConfirm'))) return;
|
||||
|
||||
this.$root.api(this.user.isSilenced ? 'admin/unsilence-user' : 'admin/silence-user', {
|
||||
userId: this.user.id
|
||||
}).then(() => {
|
||||
this.user.isSilenced = !this.user.isSilenced;
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
iconOnly: true, autoClose: true
|
||||
});
|
||||
}, e => {
|
||||
this.$root.dialog({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
async toggleSuspend() {
|
||||
if (!await this.getConfirmed(this.$t(this.user.isSuspended ? 'unsuspendConfirm' : 'suspendConfirm'))) return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue