From 0641454c233e197a70ef6e1eb89a06c90bde125f Mon Sep 17 00:00:00 2001 From: 1Step621 <86859447+1STEP621@users.noreply.github.com> Date: Thu, 1 Feb 2024 09:43:23 +0900 Subject: [PATCH] =?UTF-8?q?Fix(frontend):=20=E3=83=AA=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=81=A7=E8=87=AA=E5=88=86=E8=87=AA=E4=BF=A1=E3=82=92?= =?UTF-8?q?=E6=8B=9B=E5=BE=85=E3=81=A7=E3=81=8D=E3=82=8B=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20&=20os.selectUser()=E3=81=AEincludeSelf?= =?UTF-8?q?=E3=81=8C=E6=A9=9F=E8=83=BD=E3=81=97=E3=81=A6=E3=81=84=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=20(#13117)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * リバーシで自分自信を招待できるのを修正 & os.selectUser()のincludeSelfが機能していないのを修正 * lint fix --- .../src/components/MkUserSelectDialog.vue | 24 +++++++++++++------ packages/frontend/src/pages/reversi/index.vue | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/frontend/src/components/MkUserSelectDialog.vue b/packages/frontend/src/components/MkUserSelectDialog.vue index 1846361108..7bef0a6e73 100644 --- a/packages/frontend/src/components/MkUserSelectDialog.vue +++ b/packages/frontend/src/components/MkUserSelectDialog.vue @@ -101,7 +101,13 @@ function search() { limit: 10, detail: false, }).then(_users => { - users.value = _users; + users.value = _users.filter((u) => { + if (props.includeSelf === false) { + return u.id !== $i?.id; + } else { + return true; + } + }); }); } @@ -131,18 +137,22 @@ onMounted(() => { misskeyApi('users/show', { userIds: defaultStore.state.recentlyUsedUsers, }).then(foundUsers => { - const _users = foundUsers.filter((u) => { + let _users = foundUsers; + _users = _users.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; - } + _users = _users.filter((u) => { + if (props.includeSelf === false) { + return u.id !== $i?.id; + } else { + return true; + } + }); + recentUsers.value = _users; }); }); diff --git a/packages/frontend/src/pages/reversi/index.vue b/packages/frontend/src/pages/reversi/index.vue index fca9f9e643..f342c986fc 100644 --- a/packages/frontend/src/pages/reversi/index.vue +++ b/packages/frontend/src/pages/reversi/index.vue @@ -196,7 +196,7 @@ async function matchHeatbeat() { async function matchUser() { pleaseLogin(); - const user = await os.selectUser({ localOnly: true }); + const user = await os.selectUser({ includeSelf: false, localOnly: true }); if (user == null) return; matchingUser.value = user;