diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2024-01-30 20:54:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-30 20:54:30 +0900 |
| commit | 6a41afaaeedce1a0530eaa5835c798181f220070 (patch) | |
| tree | 025b931d36c2238537521e712839f4b09c2b5e51 /packages/frontend/src/components/MkUserSelectDialog.vue | |
| parent | refactor: frontendのcomponentsの型エラーを改善 (#12926) (diff) | |
| download | sharkey-6a41afaaeedce1a0530eaa5835c798181f220070.tar.gz sharkey-6a41afaaeedce1a0530eaa5835c798181f220070.tar.bz2 sharkey-6a41afaaeedce1a0530eaa5835c798181f220070.zip | |
fix/refactor(reversi): 既存のバグを修正・型定義を強化 (#13105)
* 既存のバグを修正
* fix types
* fix misskey-js autogen
* Update index.d.ts
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/frontend/src/components/MkUserSelectDialog.vue')
| -rw-r--r-- | packages/frontend/src/components/MkUserSelectDialog.vue | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/packages/frontend/src/components/MkUserSelectDialog.vue b/packages/frontend/src/components/MkUserSelectDialog.vue index d7bd73aa8a..1846361108 100644 --- a/packages/frontend/src/components/MkUserSelectDialog.vue +++ b/packages/frontend/src/components/MkUserSelectDialog.vue @@ -16,7 +16,11 @@ SPDX-License-Identifier: AGPL-3.0-only <template #header>{{ i18n.ts.selectUser }}</template> <div> <div :class="$style.form"> - <FormSplit :minWidth="170"> + <MkInput v-if="localOnly" v-model="username" :autofocus="true" @update:modelValue="search"> + <template #label>{{ i18n.ts.username }}</template> + <template #prefix>@</template> + </MkInput> + <FormSplit v-else :minWidth="170"> <MkInput v-model="username" :autofocus="true" @update:modelValue="search"> <template #label>{{ i18n.ts.username }}</template> <template #prefix>@</template> @@ -66,7 +70,7 @@ import { misskeyApi } from '@/scripts/misskey-api.js'; import { defaultStore } from '@/store.js'; import { i18n } from '@/i18n.js'; import { $i } from '@/account.js'; -import { hostname } from '@/config.js'; +import { host as currentHost, hostname } from '@/config.js'; const emit = defineEmits<{ (ev: 'ok', selected: Misskey.entities.UserDetailed): void; @@ -76,6 +80,7 @@ const emit = defineEmits<{ const props = defineProps<{ includeSelf?: boolean; + localOnly?: boolean; }>(); const username = ref(''); @@ -92,7 +97,7 @@ function search() { } misskeyApi('users/search-by-username-and-host', { username: username.value, - host: host.value, + host: props.localOnly ? '.' : host.value, limit: 10, detail: false, }).then(_users => { @@ -125,11 +130,18 @@ function cancel() { onMounted(() => { misskeyApi('users/show', { userIds: defaultStore.state.recentlyUsedUsers, - }).then(users => { - if (props.includeSelf && users.find(x => $i ? x.id === $i.id : true) == null) { - recentUsers.value = [$i!, ...users]; + }).then(foundUsers => { + const _users = foundUsers.filter((u) => { + if (props.localOnly) { + return u.host == null; + } else { + return true; + } + }); + if (props.includeSelf && _users.find(x => $i ? x.id === $i.id : true) == null) { + recentUsers.value = [$i!, ..._users]; } else { - recentUsers.value = users; + recentUsers.value = _users; } }); }); @@ -138,7 +150,7 @@ onMounted(() => { <style lang="scss" module> .form { - padding: 0 var(--root-margin); + padding: calc(var(--root-margin) / 2) var(--root-margin); } .result, |