fix(frontend): selectUserのパラメータを調整 (#13142)

* fix(frontend): selectUserのパラメータを調整

* ついでに軽微なスタイルの修正
This commit is contained in:
かっこかり 2024-02-02 16:49:09 +09:00 committed by GitHub
parent c38f5ee528
commit 430290c084
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 20 additions and 18 deletions

View file

@ -431,7 +431,7 @@ function applySelect() {
function chooseUser() { function chooseUser() {
props.close(); props.close();
os.selectUser().then(user => { os.selectUser({ includeSelf: true }).then(user => {
complete('user', user); complete('user', user);
props.textarea.focus(); props.textarea.focus();
}); });

View file

@ -396,6 +396,7 @@ onDeactivated(() => {
.hidden { .hidden {
width: 100%; width: 100%;
height: 100%;
background: #000; background: #000;
border: none; border: none;
outline: none; outline: none;

View file

@ -860,7 +860,7 @@ function cancel() {
} }
function insertMention() { function insertMention() {
os.selectUser().then(user => { os.selectUser({ localOnly: localOnly.value, includeSelf: true }).then(user => {
insertTextAtCursor(textareaEl.value, '@' + Misskey.acct.toString(user) + ' '); insertTextAtCursor(textareaEl.value, '@' + Misskey.acct.toString(user) + ' ');
}); });
} }

View file

@ -78,10 +78,13 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const props = defineProps<{ const props = withDefaults(defineProps<{
includeSelf?: boolean; includeSelf?: boolean;
localOnly?: boolean; localOnly?: boolean;
}>(); }>(), {
includeSelf: false,
localOnly: false,
});
const username = ref(''); const username = ref('');
const host = ref(''); const host = ref('');
@ -102,10 +105,10 @@ function search() {
detail: false, detail: false,
}).then(_users => { }).then(_users => {
users.value = _users.filter((u) => { users.value = _users.filter((u) => {
if (props.includeSelf === false) { if (props.includeSelf) {
return u.id !== $i?.id;
} else {
return true; return true;
} else {
return u.id !== $i?.id;
} }
}); });
}); });
@ -146,10 +149,10 @@ onMounted(() => {
} }
}); });
_users = _users.filter((u) => { _users = _users.filter((u) => {
if (props.includeSelf === false) { if (props.includeSelf) {
return u.id !== $i?.id;
} else {
return true; return true;
} else {
return u.id !== $i?.id;
} }
}); });
recentUsers.value = _users; recentUsers.value = _users;

View file

@ -45,7 +45,7 @@ async function init() {
} }
function chooseProxyAccount() { function chooseProxyAccount() {
os.selectUser().then(user => { os.selectUser({ localOnly: true }).then(user => {
proxyAccount.value = user; proxyAccount.value = user;
proxyAccountId.value = user.id; proxyAccountId.value = user.id;
save(); save();

View file

@ -116,9 +116,7 @@ async function del() {
} }
async function assign() { async function assign() {
const user = await os.selectUser({ const user = await os.selectUser({ includeSelf: true });
includeSelf: true,
});
const { canceled: canceled2, result: period } = await os.select({ const { canceled: canceled2, result: period } = await os.select({
title: i18n.ts.period, title: i18n.ts.period,

View file

@ -90,7 +90,7 @@ const pagination = {
}; };
function searchUser() { function searchUser() {
os.selectUser().then(user => { os.selectUser({ includeSelf: true }).then(user => {
show(user); show(user);
}); });
} }

View file

@ -129,7 +129,7 @@ async function deleteAntenna() {
} }
function addUser() { function addUser() {
os.selectUser().then(user => { os.selectUser({ includeSelf: true }).then(user => {
users.value = users.value.trim(); users.value = users.value.trim();
users.value += '\n@' + Misskey.acct.toString(user as any); users.value += '\n@' + Misskey.acct.toString(user as any);
users.value = users.value.trim(); users.value = users.value.trim();

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps_m"> <div class="_gaps_m">
<MkSwitch v-model="isLocalOnly">{{ i18n.ts.localOnly }}</MkSwitch> <MkSwitch v-model="isLocalOnly">{{ i18n.ts.localOnly }}</MkSwitch>
<MkFolder> <MkFolder :defaultOpen="true">
<template #label>{{ i18n.ts.specifyUser }}</template> <template #label>{{ i18n.ts.specifyUser }}</template>
<template v-if="user" #suffix>@{{ user.username }}</template> <template v-if="user" #suffix>@{{ user.username }}</template>
@ -64,7 +64,7 @@ const user = ref<any>(null);
const isLocalOnly = ref(false); const isLocalOnly = ref(false);
function selectUser() { function selectUser() {
os.selectUser().then(_user => { os.selectUser({ includeSelf: true }).then(_user => {
user.value = _user; user.value = _user;
}); });
} }