From 3fbb9855d836cea4bf16b3813a66c1c57f151297 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 25 Oct 2020 11:29:10 +0900 Subject: [PATCH] Clean up --- src/client/components/dialog.vue | 47 ++++++-------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/src/client/components/dialog.vue b/src/client/components/dialog.vue index 3517aa333..810f4284c 100644 --- a/src/client/components/dialog.vue +++ b/src/client/components/dialog.vue @@ -4,7 +4,7 @@
-
+
@@ -13,10 +13,8 @@
-
{{ $t('enterUsername') }}
-
- {{ (showCancelButton || input || select || user) ? $t('ok') : $t('gotIt') }} - {{ $t('cancel') }} + {{ (showCancelButton || input || select) ? $t('ok') : $t('gotIt') }} + {{ $t('cancel') }}
{{ action.text }} @@ -46,8 +44,6 @@ import MkModal from '@/components/ui/modal.vue'; import MkButton from '@/components/ui/button.vue'; import MkInput from '@/components/ui/input.vue'; import MkSelect from '@/components/ui/select.vue'; -import parseAcct from '../../misc/acct/parse'; -import * as os from '@/os'; export default defineComponent({ components: { @@ -77,9 +73,6 @@ export default defineComponent({ select: { required: false }, - user: { - required: false - }, icon: { required: false }, @@ -105,28 +98,12 @@ export default defineComponent({ data() { return { inputValue: this.input && this.input.default ? this.input.default : null, - userInputValue: null, selectedValue: this.select ? this.select.default ? this.select.default : this.select.items ? this.select.items[0].value : this.select.groupedItems[0].items[0].value : null, - canOk: true, faTimesCircle, faQuestionCircle, faSpinner, faInfoCircle, faExclamationTriangle, faCheck }; }, - watch: { - userInputValue() { - if (this.user) { - os.api('users/show', parseAcct(this.userInputValue)).then(u => { - this.canOk = u != null; - }).catch(() => { - this.canOk = false; - }); - } - }, - }, - mounted() { - if (this.user) this.canOk = false; - document.addEventListener('keydown', this.onKeydown); }, @@ -141,21 +118,13 @@ export default defineComponent({ }, async ok() { - if (!this.canOk) return; if (!this.showOkButton) return; - if (this.user) { - const user = await os.api('users/show', parseAcct(this.userInputValue)); - if (user) { - this.done(false, user); - } - } else { - const result = - this.input ? this.inputValue : - this.select ? this.selectedValue : - true; - this.done(false, result); - } + const result = + this.input ? this.inputValue : + this.select ? this.selectedValue : + true; + this.done(false, result); }, cancel() {