diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2019-04-18 03:36:06 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2019-04-18 03:36:06 +0900 |
| commit | 9ec6afa37541a307631c2826b7f923160c6d4e0f (patch) | |
| tree | 3a369ae647900a6e082fb76025dd0b82711837ab /src | |
| parent | confirm silence (#4560) (diff) | |
| download | sharkey-9ec6afa37541a307631c2826b7f923160c6d4e0f.tar.gz sharkey-9ec6afa37541a307631c2826b7f923160c6d4e0f.tar.bz2 sharkey-9ec6afa37541a307631c2826b7f923160c6d4e0f.zip | |
confirm on user menu (#4553)
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/common/views/components/user-menu.vue | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/client/app/common/views/components/user-menu.vue b/src/client/app/common/views/components/user-menu.vue index a95f7a9225..0af0fdb7e4 100644 --- a/src/client/app/common/views/components/user-menu.vue +++ b/src/client/app/common/views/components/user-menu.vue @@ -89,8 +89,10 @@ export default Vue.extend({ }); }, - toggleMute() { + async toggleMute() { if (this.user.isMuted) { + if (!await this.getConfirmed(this.$t('unmute-confirm'))) return; + this.$root.api('mute/delete', { userId: this.user.id }).then(() => { @@ -102,6 +104,8 @@ export default Vue.extend({ }); }); } else { + if (!await this.getConfirmed(this.$t('mute-confirm'))) return; + this.$root.api('mute/create', { userId: this.user.id }).then(() => { @@ -115,8 +119,10 @@ export default Vue.extend({ } }, - toggleBlock() { + async toggleBlock() { if (this.user.isBlocking) { + if (!await this.getConfirmed(this.$t('unblock-confirm'))) return; + this.$root.api('blocking/delete', { userId: this.user.id }).then(() => { @@ -128,6 +134,8 @@ export default Vue.extend({ }); }); } else { + if (!await this.getConfirmed(this.$t('block-confirm'))) return; + this.$root.api('blocking/create', { userId: this.user.id }).then(() => { @@ -164,7 +172,9 @@ export default Vue.extend({ }); }, - toggleSilence() { + async toggleSilence() { + if (!await this.getConfirmed(this.$t(this.user.isSilenced ? 'unsilence-confirm' : 'silence-confirm'))) return; + this.$root.api(this.user.isSilenced ? 'admin/unsilence-user' : 'admin/silence-user', { userId: this.user.id }).then(() => { @@ -181,7 +191,9 @@ export default Vue.extend({ }); }, - toggleSuspend() { + async toggleSuspend() { + if (!await this.getConfirmed(this.$t(this.user.isSuspended ? 'unsuspend-confirm' : 'suspend-confirm'))) return; + this.$root.api(this.user.isSuspended ? 'admin/unsuspend-user' : 'admin/suspend-user', { userId: this.user.id }).then(() => { @@ -196,7 +208,18 @@ export default Vue.extend({ text: e }); }); - } + }, + + async getConfirmed(text: string): Promise<Boolean> { + const confirm = await this.$root.dialog({ + type: 'warning', + showCancelButton: true, + title: 'confirm', + text, + }); + + return !confirm.canceled; + }, } }); </script> |