fix: 🐛query search endpoint for local userselect, disregard host

This commit is contained in:
Kainoa Kanter 2023-07-04 01:29:57 +00:00
parent 0fa4dbf11d
commit 9de97d3ebd

View file

@ -23,7 +23,7 @@
</FormSplit> </FormSplit>
</div> </div>
<div <div
v-if="username != '' || host != ''" v-if="username != ''"
class="result" class="result"
:class="{ hit: users.length > 0 }" :class="{ hit: users.length > 0 }"
> >
@ -54,7 +54,7 @@
<span>{{ i18n.ts.noUsers }}</span> <span>{{ i18n.ts.noUsers }}</span>
</div> </div>
</div> </div>
<div v-if="username == '' && host == ''" class="recent"> <div v-if="username == ''" class="recent">
<div class="users"> <div class="users">
<div <div
v-for="user in recentUsers" v-for="user in recentUsers"
@ -100,20 +100,19 @@ const emit = defineEmits<{
}>(); }>();
let username = $ref(""); let username = $ref("");
let host = $ref("");
let users: misskey.entities.UserDetailed[] = $ref([]); let users: misskey.entities.UserDetailed[] = $ref([]);
let recentUsers: misskey.entities.UserDetailed[] = $ref([]); let recentUsers: misskey.entities.UserDetailed[] = $ref([]);
let selected: misskey.entities.UserDetailed | null = $ref(null); let selected: misskey.entities.UserDetailed | null = $ref(null);
let dialogEl = $ref(); let dialogEl = $ref();
const search = () => { const search = () => {
if (username === "" && host === "") { if (username === "") {
users = []; users = [];
return; return;
} }
os.api("users/search-by-username-and-host", { os.api("users/search", {
username: username, query: username,
host: null, origin: "local",
limit: 10, limit: 10,
detail: false, detail: false,
}).then((_users) => { }).then((_users) => {