Node.js based forum software built for the modern web
refactor: use promise.all
Barış Soner Uşaklı6eab44a01d41
diff --git a/src/api/posts.js b/src/api/posts.jsindex d8971796b3..b0661cab30 100644--- a/src/api/posts.js+++ b/src/api/posts.js@@ -489,10 +489,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']);