From d3631b3342df4661e00a6e8e54131bb1aec3d215 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Nov 2020 12:40:31 +0900 Subject: [PATCH] Respect order when userIds specified --- src/server/api/endpoints/users/show.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/api/endpoints/users/show.ts b/src/server/api/endpoints/users/show.ts index ee068e8e2..9e0771a55 100644 --- a/src/server/api/endpoints/users/show.ts +++ b/src/server/api/endpoints/users/show.ts @@ -80,7 +80,13 @@ export default define(meta, async (ps, me) => { isSuspended: false }); - return await Promise.all(users.map(u => Users.pack(u, me, { + // リクエストされた通りに並べ替え + const _users = []; + for (const id of ps.userIds) { + _users.push(users.find(x => x.id === id)); + } + + return await Promise.all(_users.map(u => Users.pack(u, me, { detail: true }))); } else {