diff --git a/CHANGELOG.md b/CHANGELOG.md index d0b98db96..a9944d4b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ - Fix: AP Link等は添付ファイル扱いしないようになど (#13754) - Fix: FTTが有効かつsinceIdのみを指定した場合に帰って来るレスポンスが逆順である問題を修正 - Fix: `/i/notifications`に `includeTypes`か`excludeTypes`を指定しているとき、通知が存在するのに空配列を返すことがある問題を修正 +- Fix: 複数idを指定する`users/show`が関係ないユーザを返すことがある問題を修正 ## 2024.3.1 diff --git a/packages/backend/src/misc/json-schema.ts b/packages/backend/src/misc/json-schema.ts index a620d7c94..41e5bfe9e 100644 --- a/packages/backend/src/misc/json-schema.ts +++ b/packages/backend/src/misc/json-schema.ts @@ -228,7 +228,7 @@ export type SchemaTypeDef

= p['items']['allOf'] extends ReadonlyArray ? UnionToIntersection>>[] : never ) : - p['items'] extends NonNullable ? SchemaTypeDef[] : + p['items'] extends NonNullable ? SchemaType[] : any[] ) : p['anyOf'] extends ReadonlyArray ? UnionSchemaType & PartialIntersection> : diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index bd81989cb..26cfa921c 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -110,9 +110,11 @@ export default class extends Endpoint { // eslint- }); // リクエストされた通りに並べ替え + // 順番は保持されるけど数は減ってる可能性がある const _users: MiUser[] = []; for (const id of ps.userIds) { - _users.push(users.find(x => x.id === id)!); + const user = users.find(x => x.id === id); + if (user != null) _users.push(user); } return await Promise.all(_users.map(u => this.userEntityService.pack(u, me, { diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 7dbc12729..41d603e40 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -190,7 +190,7 @@ const localOnly = ref(props.initialLocalOnly ?? (defaultStore.state.rememberNote const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility)); const visibleUsers = ref([]); if (props.initialVisibleUsers) { - props.initialVisibleUsers.forEach(pushVisibleUser); + props.initialVisibleUsers.forEach(u => pushVisibleUser(u)); } const reactionAcceptance = ref(defaultStore.state.reactionAcceptance); const autocomplete = ref(null); @@ -336,7 +336,7 @@ if (props.reply && ['home', 'followers', 'specified'].includes(props.reply.visib misskeyApi('users/show', { userIds: props.reply.visibleUserIds.filter(uid => uid !== $i.id && uid !== props.reply?.userId), }).then(users => { - users.forEach(pushVisibleUser); + users.forEach(u => pushVisibleUser(u)); }); } @@ -967,11 +967,7 @@ onMounted(() => { } if (draft.data.visibleUserIds) { misskeyApi('users/show', { userIds: draft.data.visibleUserIds }).then(users => { - for (let i = 0; i < users.length; i++) { - if (users[i].id === draft.data.visibleUserIds[i]) { - pushVisibleUser(users[i]); - } - } + users.forEach(u => pushVisibleUser(u)); }); } }