fix/refactor(reversi): 既存のバグを修正・型定義を強化 (#13105)
* 既存のバグを修正 * fix types * fix misskey-js autogen * Update index.d.ts --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
a6a91fec3a
commit
6a41afaaee
13 changed files with 153 additions and 65 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue