Show placeholders for missing messages.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3760 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-01-15 00:29:51 +00:00
parent 5e0304481b
commit dbfa9e5623
4 changed files with 63 additions and 32 deletions

View File

@@ -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);