2018-10-31 11:16:13 +09:00
|
|
|
<template>
|
|
|
|
<ui-card>
|
2019-02-18 11:13:56 +09:00
|
|
|
<template #title><fa icon="ban"/> {{ $t('mute-and-block') }}</template>
|
2018-10-31 11:16:13 +09:00
|
|
|
|
|
|
|
<section>
|
2018-11-09 03:44:35 +09:00
|
|
|
<header>{{ $t('mute') }}</header>
|
|
|
|
<ui-info v-if="!muteFetching && mute.length == 0">{{ $t('no-muted-users') }}</ui-info>
|
2018-10-31 11:16:13 +09:00
|
|
|
<div class="users" v-if="mute.length != 0">
|
|
|
|
<div v-for="user in mute" :key="user.id">
|
2018-12-07 11:29:49 +09:00
|
|
|
<p><b><mk-user-name :user="user"/></b> @{{ user | acct }}</p>
|
2018-10-31 11:16:13 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
2018-11-09 03:44:35 +09:00
|
|
|
<header>{{ $t('block') }}</header>
|
|
|
|
<ui-info v-if="!blockFetching && block.length == 0">{{ $t('no-blocked-users') }}</ui-info>
|
2018-10-31 11:16:13 +09:00
|
|
|
<div class="users" v-if="block.length != 0">
|
|
|
|
<div v-for="user in block" :key="user.id">
|
2018-12-07 11:29:49 +09:00
|
|
|
<p><b><mk-user-name :user="user"/></b> @{{ user | acct }}</p>
|
2018-10-31 11:16:13 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
2018-11-11 21:17:51 +09:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<header>{{ $t('word-mute') }}</header>
|
|
|
|
<ui-textarea v-model="mutedWords">
|
2019-02-18 11:13:56 +09:00
|
|
|
{{ $t('muted-words') }}<template #desc>{{ $t('muted-words-description') }}</template>
|
2018-11-11 21:17:51 +09:00
|
|
|
</ui-textarea>
|
|
|
|
<ui-button @click="save">{{ $t('save') }}</ui-button>
|
|
|
|
</section>
|
2018-10-31 11:16:13 +09:00
|
|
|
</ui-card>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-09 03:44:35 +09:00
|
|
|
import i18n from '../../../i18n';
|
2018-10-31 11:16:13 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-09 03:44:35 +09:00
|
|
|
i18n: i18n('common/views/components/mute-and-block.vue'),
|
2018-11-11 21:17:51 +09:00
|
|
|
|
2018-10-31 11:16:13 +09:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
muteFetching: true,
|
|
|
|
blockFetching: true,
|
|
|
|
mute: [],
|
2018-11-11 21:17:51 +09:00
|
|
|
block: [],
|
|
|
|
mutedWords: ''
|
2018-10-31 11:16:13 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2018-11-11 21:17:51 +09:00
|
|
|
computed: {
|
|
|
|
_mutedWords: {
|
|
|
|
get() { return this.$store.state.settings.mutedWords; },
|
|
|
|
set(value) { this.$store.dispatch('settings/set', { key: 'mutedWords', value }); }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-10-31 11:16:13 +09:00
|
|
|
mounted() {
|
2018-11-11 21:17:51 +09:00
|
|
|
this.mutedWords = this._mutedWords.map(words => words.join(' ')).join('\n');
|
|
|
|
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('mute/list').then(mute => {
|
2018-10-31 11:16:13 +09:00
|
|
|
this.mute = mute.map(x => x.mutee);
|
|
|
|
this.muteFetching = false;
|
|
|
|
});
|
|
|
|
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('blocking/list').then(blocking => {
|
2018-10-31 11:16:13 +09:00
|
|
|
this.block = blocking.map(x => x.blockee);
|
|
|
|
this.blockFetching = false;
|
|
|
|
});
|
2018-11-11 21:17:51 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
save() {
|
2018-11-29 20:09:41 +09:00
|
|
|
this._mutedWords = this.mutedWords.split('\n').map(line => line.split(' ').filter(x => x != ''));
|
2018-11-11 21:17:51 +09:00
|
|
|
}
|
2018-10-31 11:16:13 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|