Fix(frontend): リバーシで自分自信を招待できるのを修正 & os.selectUser()のincludeSelfが機能していないのを修正 (#13117)

* リバーシで自分自信を招待できるのを修正 & os.selectUser()のincludeSelfが機能していないのを修正

* lint fix
This commit is contained in:
1Step621 2024-02-01 09:43:23 +09:00 committed by GitHub
parent 5079a4b7dd
commit 0641454c23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 8 deletions

View File

@ -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;
});
});
</script>

View File

@ -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;