enhance(client): ミュートされたノート数を表示するようにしたり

This commit is contained in:
syuilo 2020-08-09 13:46:19 +09:00
parent 917d3d0bd3
commit d780e5b251
7 changed files with 39 additions and 11 deletions

View File

@ -572,6 +572,7 @@ _wordMute:
hardDescription: "指定した条件のノートをタイムラインに追加しないようにします。追加されなかったノートは、条件を変更しても除外されたままになります。" hardDescription: "指定した条件のノートをタイムラインに追加しないようにします。追加されなかったノートは、条件を変更しても除外されたままになります。"
soft: "ソフト" soft: "ソフト"
hard: "ハード" hard: "ハード"
mutedNotesCount: "{count}ノートがミュートされました"
_theme: _theme:
explore: "テーマを探す" explore: "テーマを探す"

View File

@ -64,7 +64,7 @@
<div class="suffix" ref="suffix"><slot name="suffix"></slot></div> <div class="suffix" ref="suffix"><slot name="suffix"></slot></div>
</div> </div>
<button class="save _textButton" v-if="save && changed" @click="() => { changed = false; save(); }">{{ $t('save') }}</button> <button class="save _textButton" v-if="save && changed" @click="() => { changed = false; save(); }">{{ $t('save') }}</button>
<div class="desc"><slot name="desc"></slot></div> <div class="desc _caption"><slot name="desc"></slot></div>
</div> </div>
</template> </template>
@ -401,13 +401,11 @@ export default Vue.extend({
> .save { > .save {
margin: 6px 0 0 0; margin: 6px 0 0 0;
font-size: 13px; font-size: 0.8em;
} }
> .desc { > .desc {
margin: 6px 0 0 0; margin: 6px 0 0 0;
font-size: 13px;
opacity: 0.7;
&:empty { &:empty {
display: none; display: none;

View File

@ -196,7 +196,7 @@ export default Vue.extend({
> .text { > .text {
margin: 6px 0; margin: 6px 0;
font-size: 13px; font-size: 0.8em;
&:empty { &:empty {
display: none; display: none;

View File

@ -14,7 +14,7 @@
></textarea> ></textarea>
</div> </div>
<button class="save _textButton" v-if="save && changed" @click="() => { changed = false; save(); }">{{ $t('save') }}</button> <button class="save _textButton" v-if="save && changed" @click="() => { changed = false; save(); }">{{ $t('save') }}</button>
<div class="desc"><slot name="desc"></slot></div> <div class="desc _caption"><slot name="desc"></slot></div>
</div> </div>
</template> </template>
@ -163,13 +163,11 @@ export default Vue.extend({
> .save { > .save {
margin: 6px 0 0 0; margin: 6px 0 0 0;
font-size: 13px; font-size: 0.8em;
} }
> .desc { > .desc {
margin: 6px 0 0 0; margin: 6px 0 0 0;
font-size: 13px;
opacity: 0.7;
&:empty { &:empty {
display: none; display: none;

View File

@ -13,10 +13,11 @@
</div> </div>
<div class="_content" v-show="tab === 'hard'"> <div class="_content" v-show="tab === 'hard'">
<mk-info>{{ $t('_wordMute.hardDescription') }}</mk-info> <mk-info>{{ $t('_wordMute.hardDescription') }}</mk-info>
<mk-textarea v-model="hardMutedWords"> <mk-textarea v-model="hardMutedWords" style="margin-bottom: 16px;">
<span>{{ $t('_wordMute.muteWords') }}</span> <span>{{ $t('_wordMute.muteWords') }}</span>
<template #desc>{{ $t('_wordMute.muteWordsDescription') }}<br>{{ $t('_wordMute.muteWordsDescription2') }}</template> <template #desc>{{ $t('_wordMute.muteWordsDescription') }}<br>{{ $t('_wordMute.muteWordsDescription2') }}</template>
</mk-textarea> </mk-textarea>
<div v-if="hardWordMutedNotesCount != null" class="_caption">{{ $t('_wordMute.mutedNotesCount', { count: hardWordMutedNotesCount }) }}</div>
</div> </div>
<div class="_footer"> <div class="_footer">
<mk-button @click="save()" primary inline :disabled="!changed"><fa :icon="faSave"/> {{ $t('save') }}</mk-button> <mk-button @click="save()" primary inline :disabled="!changed"><fa :icon="faSave"/> {{ $t('save') }}</mk-button>
@ -45,6 +46,7 @@ export default Vue.extend({
tab: 'soft', tab: 'soft',
softMutedWords: '', softMutedWords: '',
hardMutedWords: '', hardMutedWords: '',
hardWordMutedNotesCount: null,
changed: false, changed: false,
faCommentSlash, faSave, faCommentSlash, faSave,
} }
@ -59,9 +61,11 @@ export default Vue.extend({
}, },
}, },
created() { async created() {
this.softMutedWords = this.$store.state.settings.mutedWords.map(x => x.join(' ')).join('\n'); this.softMutedWords = this.$store.state.settings.mutedWords.map(x => x.join(' ')).join('\n');
this.hardMutedWords = this.$store.state.i.mutedWords.map(x => x.join(' ')).join('\n'); this.hardMutedWords = this.$store.state.i.mutedWords.map(x => x.join(' ')).join('\n');
this.hardWordMutedNotesCount = (await this.$root.api('i/get-word-muted-notes-count', {})).count;
}, },
methods: { methods: {

View File

@ -413,6 +413,11 @@ hr {
color: var(--link); color: var(--link);
} }
._caption {
font-size: 0.8em;
opacity: 0.7;
}
.zoom-enter-active, .zoom-leave-active { .zoom-enter-active, .zoom-leave-active {
transition: opacity 0.5s, transform 0.5s !important; transition: opacity 0.5s, transform 0.5s !important;
} }

View File

@ -0,0 +1,22 @@
import define from '../../define';
import { MutedNotes } from '../../../../models';
export const meta = {
tags: ['account'],
requireCredential: true as const,
kind: 'read:account',
params: {
}
};
export default define(meta, async (ps, user) => {
return {
count: await MutedNotes.count({
userId: user.id,
reason: 'word'
})
};
});