diff --git a/apps/cory/index.json b/apps/cory/index.json index c86a2ef2..3c3972d1 100644 --- a/apps/cory/index.json +++ b/apps/cory/index.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&LAPhIEnIVpfzC4R5D93GtAPrKgViVV3wbHHzfa7tAr4=.sha256","index.html":"&/CE4CuVKI56h5tfAHF0kzCXbLfhVjWzsM8aZAB9HpEM=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&gBMlL/D2sGuvFQR46qXM1ERLA+baZDp9h/4jOD42k7w=.sha256","tf.js":"&gJUMwBsssB+Suy/NTUjcB3JeloFLvV18i6egqvThaVY=.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":"&g8ietss5dxwzLkFreH1YCDH1fLr53CgA0htu9+lr8Ok=.sha256","index.html":"&/CE4CuVKI56h5tfAHF0kzCXbLfhVjWzsM8aZAB9HpEM=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&ZQuSBy1K3iASz/NVEa8ILA6aOefHZUmBa/Ddpcl7ZyI=.sha256","tf.js":"&oNOs6Ha7Rsd2fectO5NVhsWdwu/vkLBNIvr8l9Vj6ds=.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 ba44bfb1..871788ed 100644 --- a/apps/cory/index/app.js +++ b/apps/cory/index/app.js @@ -239,7 +239,7 @@ async function getRelatedPostIds(db, message, ids, limit) { " json_extract(content, '$.type') = 'post' AND "+ " (id = ? OR json_extract(content, '$.root') = ?) "+ "ORDER BY timestamp DESC LIMIT ?", - [].concat([message.timestamp, row_id_max], ids_batch, [message.id, id, limit]), + [].concat([message.timestamp || 0, row_id_max], ids_batch, [message.id, id, limit]), function(row) { if (row.id) { recent.push({id: row.id, timestamp: row.timestamp}); @@ -336,7 +336,8 @@ async function refresh(selected) { var ids; if (selected && selected.length == 1 && selected[0].startsWith('%')) { var m = await getPosts(db, selected); - ids = m.length ? await getRelatedPostIds(db, m[0], all_followed, k_posts_max) : []; + m = m.length ? m[0] : {id: selected[0]}; + ids = await getRelatedPostIds(db, m, all_followed, k_posts_max); } else { ids = await getRecentPostIds(db, whoami, g_selected, k_posts_max); } diff --git a/apps/cory/index/tf-message.js b/apps/cory/index/tf-message.js index a8e9a4d9..31d01ee3 100644 --- a/apps/cory/index/tf-message.js +++ b/apps/cory/index/tf-message.js @@ -56,44 +56,54 @@ Vue.component('tf-message', { percent - + -
- {{new Date(message.timestamp)}} - {{message.id}} -
-
- - - Show Raw Message - -
+ + -
-

{{message.id}}

-
{{content_raw}}
-
-
-
-
-
- {{mention.name}} - + + {{vote + (votes[message.id][vote].length > 1 ? ' (' + votes[message.id][vote].length + ')' : '')}} - + reply diff --git a/apps/cory/index/tf.js b/apps/cory/index/tf.js index e8208fc5..69661808 100644 --- a/apps/cory/index/tf.js +++ b/apps/cory/index/tf.js @@ -48,6 +48,17 @@ function processMessages() { found = true; } } + if (!found) { + var fake_root = { + id: root, + children: [new_message], + timestamp: new_message.timestamp, + content: '{}', + }; + g_data.messages.push(fake_root); + g_data.messages.sort((x, y) => y.timestamp - x.timestamp); + found = true; + } } var removed = {}; for (let message of g_data.messages) { @@ -58,6 +69,15 @@ function processMessages() { } } g_data.messages = g_data.messages.filter(x => !removed[x.id]); + if (!found) { + for (let message of g_data.messages) { + if (message.id == new_message.id) { + new_message.children = message.children; + Vue.set(g_data.messages, g_data.messages.indexOf(message), new_message); + found = true; + } + } + } if (!found) { g_data.messages.push(new_message); g_data.messages.sort((x, y) => y.timestamp - x.timestamp);