Just messing around with things. Not sure I've made anything better.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3722 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-12-31 00:57:57 +00:00
parent 0cab3e7ed9
commit fafc524c8c
3 changed files with 48 additions and 38 deletions

View File

@@ -273,33 +273,35 @@ async function refresh() {
app.postMessage({connections: await ssb.connections()}),
app.postMessage({apps: await core.apps()}),
followingDeep(db, [whoami], 2).then(function(f) {
getRecentPostIds(db, whoami, [].concat([whoami], f), k_posts_max).then(async function(ids) {
return getPosts(db, ids);
}).then(async function(posts) {
var roots = posts.map(function(x) {
try {
return JSON.parse(x.content).root;
} catch {
return null;
}
});
roots = roots.filter(function(root) {
return root && posts.every(post => post.id != root);
});
return [].concat(posts, await getPosts(db, roots));
}).then(function(posts) {
return Promise.all(posts.map(x => app.postMessage({message: x})));
});
Promise.all(f.map(function(id) {
return Promise.all([
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}});
}),
]);
}));
return Promise.all([
getRecentPostIds(db, whoami, [].concat([whoami], f), k_posts_max).then(async function(ids) {
return getPosts(db, ids);
}).then(async function(posts) {
var roots = posts.map(function(x) {
try {
return JSON.parse(x.content).root;
} catch {
return null;
}
});
roots = roots.filter(function(root) {
return root && posts.every(post => post.id != root);
});
return [].concat(posts, await getPosts(db, roots));
}).then(function(posts) {
return Promise.all(posts.map(x => app.postMessage({message: x})));
}),
Promise.all(f.map(function(id) {
return Promise.all([
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}});
}),
]);
})),
]);
}),
sendUser(db, whoami),
]);