Skip to content

Commit

Permalink
Fix(frontend): リバーシで自分自信を招待できるのを修正 & os.selectUser()のincludeSelfが機能して…
Browse files Browse the repository at this point in the history
…いないのを修正 (#13117)

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

* lint fix
  • Loading branch information
1Step621 authored Feb 1, 2024
1 parent 5079a4b commit 0641454
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions packages/frontend/src/components/MkUserSelectDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
});
}

Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/reversi/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0641454

Please sign in to comment.