From 1cf55d7d64d890036e72b5a05e5688fb3c695353 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 8 Jan 2022 00:08:01 +0000 Subject: [PATCH] Minor refresh cleanup. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3738 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/cory/index.json | 2 +- apps/cory/index/app.js | 23 +++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/apps/cory/index.json b/apps/cory/index.json index 9409403a..b5629cc8 100644 --- a/apps/cory/index.json +++ b/apps/cory/index.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&l8lBRLBokCaXK/v4sF5qMgQHGqizkMjY8ady4FYaD0U=.sha256","index.html":"&ayK1muTik0h4UYNvT0QNm0WrygVrL8kxBoEyrQkHyHs=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&fXhPpneuYuseoaYk25ODN3QecFAeOfuMOZd98OgvjsQ=.sha256","tf-message.js":"&oQggZN26PtRi4Ce9HY8TKVJ9jRrYWLRE5tN+3yHwEJE=.sha256","tf.js":"&EgrrFfINhqFL/Kj8qkJwH/DHTLrZ8CxhHDBxZjcyjUY=.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":"&a+Oh7UhItwSL0e7SRHD8rm/T3hBk6RUx4iXxuFy8u5g=.sha256","index.html":"&ayK1muTik0h4UYNvT0QNm0WrygVrL8kxBoEyrQkHyHs=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&fXhPpneuYuseoaYk25ODN3QecFAeOfuMOZd98OgvjsQ=.sha256","tf-message.js":"&oQggZN26PtRi4Ce9HY8TKVJ9jRrYWLRE5tN+3yHwEJE=.sha256","tf.js":"&EgrrFfINhqFL/Kj8qkJwH/DHTLrZ8CxhHDBxZjcyjUY=.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 3a3d76cf..60131fae 100644 --- a/apps/cory/index/app.js +++ b/apps/cory/index/app.js @@ -61,7 +61,7 @@ async function followingDeep(db, seed_ids, depth) { var f = await Promise.all(seed_ids.map(x => following(db, x))); var ids = [].concat(...f); var x = await followingDeep(db, [...new Set(ids)].sort(), depth - 1); - x = [].concat(...x, ...seed_ids); + x = [...new Set([].concat(...x, ...seed_ids))].sort(); g_following_deep_cache[key] = x; return x; } @@ -279,26 +279,17 @@ async function refresh(selected) { return null; } }); - roots = roots.filter(function(root) { - return root && posts.every(post => post.id != root); - }); + var have = posts.map(x => x.id); + roots = [...new Set(roots)].filter(x => x && !have[x]); var all_posts = [].concat(posts, await getPosts(db, roots)); return Promise.all(all_posts.map(x => app.postMessage({message: x}))); }), Promise.all([].concat(all_followed.map(function(id) { return [ - getVotes(db, id).then(function(votes) { - return app.postMessage({votes: votes}); - }), - getAbout(db, id).then(function(user) { - return app.postMessage({user: {user: id, about: user}}); - }), - 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}}); - }), + getVotes(db, id).then(votes => app.postMessage({votes: votes})), + getAbout(db, id).then(user => app.postMessage({user: {user: id, about: user}})), + following(db, id).then(f => app.postMessage({following: {id: id, users: f}})), + followers(db, id).then(f => app.postMessage({followers: {id: id, users: f}})), ]; }))), ]);