From e1448a1c3ac333970cd36cbb966eb07db37fbe79 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 3 Jan 2022 01:30:53 +0000 Subject: [PATCH] Simplify sendUser. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3731 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/cory/index.json | 2 +- apps/cory/index/app.js | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/apps/cory/index.json b/apps/cory/index.json index 51073fbc..45fad757 100644 --- a/apps/cory/index.json +++ b/apps/cory/index.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&M2cicx5n1kGmenEYnNXakB4Hc7N5UZXsnJheE7hvKLc=.sha256","index.html":"&dyJyLJJqx+qcGXY9CYLY6Jxj/T/ZK+Z8ARa8MhLVhJI=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&EuejzX/iNHsGkscTHJHeJ8YXukGb31KE8YGUMonXJB0=.sha256","tf-message.js":"&oQggZN26PtRi4Ce9HY8TKVJ9jRrYWLRE5tN+3yHwEJE=.sha256","tf.js":"&xNEPeISBMcsMcE7o1XFrj5JT5z+UMEGPajLQYZYfh2k=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&kDS3+lAYQ3lTn9BExKQnXooSEb8AEFKv0r3ioKx6N7Y=.sha256","index.html":"&dyJyLJJqx+qcGXY9CYLY6Jxj/T/ZK+Z8ARa8MhLVhJI=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&EuejzX/iNHsGkscTHJHeJ8YXukGb31KE8YGUMonXJB0=.sha256","tf-message.js":"&oQggZN26PtRi4Ce9HY8TKVJ9jRrYWLRE5tN+3yHwEJE=.sha256","tf.js":"&xNEPeISBMcsMcE7o1XFrj5JT5z+UMEGPajLQYZYfh2k=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}} \ No newline at end of file diff --git a/apps/cory/index/app.js b/apps/cory/index/app.js index 8c160eff..48a3a315 100644 --- a/apps/cory/index/app.js +++ b/apps/cory/index/app.js @@ -81,17 +81,6 @@ async function followers(db, id) { return results; } -async function sendUser(db, id) { - return Promise.all([ - following(db, id).then(async function(following) { - return app.postMessage({following: {id: id, users: following}}); - }), - followers(db, id).then(async function(followers) { - return app.postMessage({followers: {id: id, users: followers}}); - }), - ]); -} - async function getAbout(db, id) { var o = await db.get(id + ":about"); const k_version = 4; @@ -284,7 +273,7 @@ async function refresh() { }).then(function(posts) { return Promise.all(posts.map(x => app.postMessage({message: x}))); }).then(function() { - return f.map(function(id) { + return Promise.all(f.map(function(id) { return Promise.all([ getVotes(db, id).then(function(votes) { return app.postMessage({votes: votes}); @@ -292,9 +281,14 @@ async function refresh() { getAbout(db, id).then(function(user) { return app.postMessage({user: {user: id, about: user}}); }), - sendUser(db, id), + following(db, id).then(function(following) { + return app.postMessage({following: {id: id, users: following}}); + }), + followers(db, id).then(function(followers) { + return app.postMessage({followers: {id: id, users: followers}}); + }), ]); - }); + })); }); }), ]);