Minor refresh cleanup.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3738 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-01-08 00:08:01 +00:00
parent ae84f69025
commit 1cf55d7d64
2 changed files with 8 additions and 17 deletions

View File

@ -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"}} {"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"}}

View File

@ -61,7 +61,7 @@ async function followingDeep(db, seed_ids, depth) {
var f = await Promise.all(seed_ids.map(x => following(db, x))); var f = await Promise.all(seed_ids.map(x => following(db, x)));
var ids = [].concat(...f); var ids = [].concat(...f);
var x = await followingDeep(db, [...new Set(ids)].sort(), depth - 1); 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; g_following_deep_cache[key] = x;
return x; return x;
} }
@ -279,26 +279,17 @@ async function refresh(selected) {
return null; return null;
} }
}); });
roots = roots.filter(function(root) { var have = posts.map(x => x.id);
return root && posts.every(post => post.id != root); roots = [...new Set(roots)].filter(x => x && !have[x]);
});
var all_posts = [].concat(posts, await getPosts(db, roots)); var all_posts = [].concat(posts, await getPosts(db, roots));
return Promise.all(all_posts.map(x => app.postMessage({message: x}))); return Promise.all(all_posts.map(x => app.postMessage({message: x})));
}), }),
Promise.all([].concat(all_followed.map(function(id) { Promise.all([].concat(all_followed.map(function(id) {
return [ return [
getVotes(db, id).then(function(votes) { getVotes(db, id).then(votes => app.postMessage({votes: votes})),
return 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}})),
getAbout(db, id).then(function(user) { followers(db, id).then(f => app.postMessage({followers: {id: id, users: f}})),
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}});
}),
]; ];
}))), }))),
]); ]);