Node.js based forum software built for the modern web
refactor: use promise.all
Barış Soner Uşaklı7c00e814b711
diff --git a/src/api/posts.js b/src/api/posts.jsindex f41b6a66ea..3eda085dec 100644--- a/src/api/posts.js+++ b/src/api/posts.js@@ -491,10 +491,12 @@ async function diffsPrivilegeCheck(pid, uid) {postsAPI.getDiffs = async (caller, data) => {await diffsPrivilegeCheck(data.pid, caller.uid);- const timestamps = await posts.diffs.list(data.pid);- const post = await posts.getPostFields(data.pid, ['timestamp', 'uid']);+ const [timestamps, post, diffs] = await Promise.all([+ posts.diffs.list(data.pid),+ posts.getPostFields(data.pid, ['timestamp', 'uid']),+ posts.diffs.get(data.pid),+ ]);- const diffs = await posts.diffs.get(data.pid);const uids = diffs.map(diff => diff.uid || null);uids.push(post.uid);let usernames = await user.getUsersFields(uids, ['username']);