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

View file

@ -64,7 +64,7 @@
<div class="suffix" ref="suffix"><slot name="suffix"></slot></div>
</div>
<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>
</template>
@ -401,13 +401,11 @@ export default Vue.extend({
> .save {
margin: 6px 0 0 0;
font-size: 13px;
font-size: 0.8em;
}
> .desc {
margin: 6px 0 0 0;
font-size: 13px;
opacity: 0.7;
&:empty {
display: none;

View file

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

View file

@ -14,7 +14,7 @@
></textarea>
</div>
<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>
</template>
@ -163,13 +163,11 @@ export default Vue.extend({
> .save {
margin: 6px 0 0 0;
font-size: 13px;
font-size: 0.8em;
}
> .desc {
margin: 6px 0 0 0;
font-size: 13px;
opacity: 0.7;
&:empty {
display: none;

View file

@ -13,10 +13,11 @@
</div>
<div class="_content" v-show="tab === 'hard'">
<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>
<template #desc>{{ $t('_wordMute.muteWordsDescription') }}<br>{{ $t('_wordMute.muteWordsDescription2') }}</template>
</mk-textarea>
<div v-if="hardWordMutedNotesCount != null" class="_caption">{{ $t('_wordMute.mutedNotesCount', { count: hardWordMutedNotesCount }) }}</div>
</div>
<div class="_footer">
<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',
softMutedWords: '',
hardMutedWords: '',
hardWordMutedNotesCount: null,
changed: false,
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.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: {

View file

@ -413,6 +413,11 @@ hr {
color: var(--link);
}
._caption {
font-size: 0.8em;
opacity: 0.7;
}
.zoom-enter-active, .zoom-leave-active {
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'
})
};
});