Send followers/following information differently so that we load posts faster.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3727 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-01-02 15:36:11 +00:00
parent 3026443c1e
commit 4268963e70
3 changed files with 15 additions and 21 deletions

View File

@ -1 +1 @@
{"type":"tildefriends-app","files":{"app.js":"&W9Hxi6cX37sg8daxdiuvZMLJj0FJLoVAYE65T/X6Yp8=.sha256","index.html":"&dyJyLJJqx+qcGXY9CYLY6Jxj/T/ZK+Z8ARa8MhLVhJI=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&KmUw2D8yehJU95RQ+8DWP69w/5wK7yWR6fUc5/LIpio=.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"}} {"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"}}

View File

@ -267,8 +267,7 @@ async function refresh() {
app.postMessage({connections: await ssb.connections()}), app.postMessage({connections: await ssb.connections()}),
app.postMessage({apps: await core.apps()}), app.postMessage({apps: await core.apps()}),
followingDeep(db, [whoami], 2).then(function(f) { followingDeep(db, [whoami], 2).then(function(f) {
return Promise.all([ return getRecentPostIds(db, whoami, [].concat([whoami], f), k_posts_max).then(async function(ids) {
getRecentPostIds(db, whoami, [].concat([whoami], f), k_posts_max).then(async function(ids) {
return getPosts(db, ids); return getPosts(db, ids);
}).then(async function(posts) { }).then(async function(posts) {
var roots = posts.map(function(x) { var roots = posts.map(function(x) {
@ -284,20 +283,20 @@ async function refresh() {
return [].concat(posts, await getPosts(db, roots)); return [].concat(posts, await getPosts(db, roots));
}).then(function(posts) { }).then(function(posts) {
return Promise.all(posts.map(x => app.postMessage({message: x}))); return Promise.all(posts.map(x => app.postMessage({message: x})));
}), }).then(function() {
Promise.all(f.map(function(id) { return f.map(function(id) {
return Promise.all([ return Promise.all([
getVotes(db, id).then(function(votes) { getVotes(db, id).then(function(votes) {
return app.postMessage({votes: votes}); return app.postMessage({votes: votes});
}), }),
getAbout(db, id).then(function(user) { getAbout(db, id).then(function(user) {
return app.postMessage({user: {user: id, about: user}}); return app.postMessage({user: {user: id, about: user}});
}), }),
]); sendUser(db, id),
})), ]);
]); });
});
}), }),
sendUser(db, whoami),
]); ]);
} }
@ -321,8 +320,6 @@ core.register('message', async function(m) {
await ssb.connect(m.message.connect); await ssb.connect(m.message.connect);
} else if (m.message.appendMessage) { } else if (m.message.appendMessage) {
await ssb.appendMessage(m.message.appendMessage); await ssb.appendMessage(m.message.appendMessage);
} else if (m.message.user) {
await sendUser(await database("ssb"), m.message.user);
} else if (m.message.refresh) { } else if (m.message.refresh) {
await refresh(); await refresh();
} }

View File

@ -7,9 +7,6 @@ Vue.component('tf-user', {
edit_profile_description: null, edit_profile_description: null,
} }, } },
props: ['id'], props: ['id'],
mounted: function() {
window.parent.postMessage({user: this.id}, '*');
},
computed: { computed: {
following: { following: {
get: function() { get: function() {