[Client] Resolve #3226

This commit is contained in:
syuilo 2019-02-02 23:20:40 +09:00
parent 4ea7e711ce
commit 2b0cb6d728
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
3 changed files with 53 additions and 1 deletions

View file

@ -6,6 +6,7 @@ unreleased
* 動画のサムネイルを作成するように
* リモートの外部サービス認証情報を表示するように
* public の Renote/Reply/Quote先 が public以外 だったら、public => homeに
* ユーザーページから管理者/モデレーターがアカウントのサイレンス/凍結をできるように
* 凍結されたユーザーをタイムライン等に表示しないように
* おすすめのアンケートでミュートユーザーのものは表示しないように
* おすすめのアンケートで凍結済みユーザーのものは表示しないように

View file

@ -391,6 +391,10 @@ common/views/components/user-menu.vue:
report-abuse: "スパムを報告"
report-abuse-detail: "どのような迷惑行為を行っていますか?"
report-abuse-reported: "管理者に報告されました。ご協力ありがとうございました。"
silence: "サイレンス"
unsilence: "サイレンス解除"
suspend: "凍結"
unsuspend: "凍結解除"
common/views/components/poll.vue:
vote-to: "「{}」に投票する"

View file

@ -8,7 +8,8 @@
import Vue from 'vue';
import i18n from '../../../i18n';
import copyToClipboard from '../../../common/scripts/copy-to-clipboard';
import { faExclamationCircle } from '@fortawesome/free-solid-svg-icons';
import { faExclamationCircle, faMicrophoneSlash } from '@fortawesome/free-solid-svg-icons';
import { faSnowflake } from '@fortawesome/free-regular-svg-icons';
export default Vue.extend({
i18n: i18n('common/views/components/user-menu.vue'),
@ -40,6 +41,18 @@ export default Vue.extend({
action: this.reportAbuse
}];
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
}]);
}
return {
items: menu
};
@ -148,6 +161,40 @@ export default Vue.extend({
text: e
});
});
},
toggleSilence() {
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',
splash: true
});
}, e => {
this.$root.dialog({
type: 'error',
text: e
});
});
},
toggleSuspend() {
this.$root.api(this.user.isSuspended ? 'admin/unsuspend-user' : 'admin/suspend-user', {
userId: this.user.id
}).then(() => {
this.user.isSuspended = !this.user.isSuspended;
this.$root.dialog({
type: 'success',
splash: true
});
}, e => {
this.$root.dialog({
type: 'error',
text: e
});
});
}
}
});