Fixed some messages not finding their root.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3736 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
e2c25ab414
commit
49ffd1055e
@ -1 +1 @@
|
|||||||
{"type":"tildefriends-app","files":{"app.js":"&og7bNeqxTfUqVTdtPsrJTjirJxyE3xDQYp0Pj7KmL2U=.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"}}
|
{"type":"tildefriends-app","files":{"app.js":"&og7bNeqxTfUqVTdtPsrJTjirJxyE3xDQYp0Pj7KmL2U=.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":"&27+G0/I9PyIu7zl2yk8jesy6uEI1ZJlax0u5enVDdUw=.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"}}
|
@ -25,28 +25,30 @@ function processMessages() {
|
|||||||
for (let event of g_message_queue) {
|
for (let event of g_message_queue) {
|
||||||
var key = Object.keys(event.data)[0];
|
var key = Object.keys(event.data)[0];
|
||||||
if (key == 'message') {
|
if (key == 'message') {
|
||||||
event.data[key].children = [];
|
var new_message = event.data.message;
|
||||||
|
new_message.children = [];
|
||||||
var found = false;
|
var found = false;
|
||||||
var root = JSON.parse(event.data[key].content).root;
|
var root = JSON.parse(new_message.content).root;
|
||||||
if (root) {
|
if (root) {
|
||||||
for (let message of g_data.messages) {
|
for (let message of g_data.messages) {
|
||||||
if (root == message.id) {
|
if (root == message.id) {
|
||||||
message.children.push(event.data[key]);
|
message.children.push(new_message);
|
||||||
message.children.sort((x, y) => y.timestamp - x.timestamp);
|
message.children.sort((x, y) => y.timestamp - x.timestamp);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var removed = {};
|
||||||
for (let message of g_data.messages) {
|
for (let message of g_data.messages) {
|
||||||
if (JSON.parse(message.content).root == event.data[key].id) {
|
if (JSON.parse(message.content).root == new_message.id) {
|
||||||
event.data[key].children.push(message);
|
new_message.children.push(message);
|
||||||
event.data[key].children.sort((x, y) => y.timestamp - x.timestamp);
|
new_message.children.sort((x, y) => y.timestamp - x.timestamp);
|
||||||
g_data.messages.splice(g_data.messages.indexOf(message), 1);
|
removed[message.id] = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_data.messages = g_data.messages.filter(x => !removed[x.id]);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
g_data.messages.push(event.data[key]);
|
g_data.messages.push(new_message);
|
||||||
g_data.messages.sort((x, y) => y.timestamp - x.timestamp);
|
g_data.messages.sort((x, y) => y.timestamp - x.timestamp);
|
||||||
}
|
}
|
||||||
} else if (key + 's' in g_data && Array.isArray(g_data[key + 's'])) {
|
} else if (key + 's' in g_data && Array.isArray(g_data[key + 's'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user