forked from cory/tildefriends
Fix some wiki issues I found while making journal.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4608 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
f9c370212b
commit
61a3226e14
@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "tildefriends-app",
|
||||
"emoji": "📝",
|
||||
"previous": "&IJPpdyG/+rYiBwT0loE38hisCHZ2T/i7lpA3a2+wBgA=.sha256"
|
||||
"previous": "&uHuaLkW5F8E1aJ58hpoz72hWZZHIT2gaExUFSb8D6eI=.sha256"
|
||||
}
|
@ -95,7 +95,7 @@ async function process_message(whoami, collection, message, kind, parent) {
|
||||
if (typeof content == 'string') {
|
||||
let x;
|
||||
for (let id of whoami) {
|
||||
x = await tfrpc.rpc.try_decrypt(whoami, content);
|
||||
x = await ssb.privateMessageDecrypt(id, content);
|
||||
if (x) {
|
||||
content = JSON.parse(x);
|
||||
content.draft = true;
|
||||
@ -105,18 +105,19 @@ async function process_message(whoami, collection, message, kind, parent) {
|
||||
if (!x) {
|
||||
return;
|
||||
}
|
||||
if (content.type !== type ||
|
||||
if (content.type !== kind ||
|
||||
(parent && content.parent !== parent)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
content.draft = false;
|
||||
}
|
||||
print(message.id, content);
|
||||
if (content?.key) {
|
||||
if (content?.tombstone) {
|
||||
delete collection[content.key];
|
||||
} else if (collection[content.key]) {
|
||||
collection[content.key] = Object.assign(collection[content.key], content);
|
||||
} else {
|
||||
collection[content.key] = Object.assign(collection[content.key] || {}, content);
|
||||
}
|
||||
} else {
|
||||
collection[message.id] = Object.assign(content, {id: message.id});
|
||||
@ -140,6 +141,7 @@ tfrpc.register(async function collection(ids, kind, parent, max_rowid, data) {
|
||||
}
|
||||
|
||||
let modified = false;
|
||||
let rows = [];
|
||||
await ssb.sqlAsync(`
|
||||
SELECT messages.id, author, content, timestamp
|
||||
FROM messages
|
||||
@ -150,11 +152,14 @@ tfrpc.register(async function collection(ids, kind, parent, max_rowid, data) {
|
||||
((json_extract(messages.content, '$.type') = ?4 AND
|
||||
(?5 IS NULL OR json_extract(messages.content, '$.parent') = ?5)) OR
|
||||
content LIKE '"%')
|
||||
`, [JSON.stringify(ids), max_rowid ?? -1, rowid, kind, parent], function(row) {
|
||||
if (process_message(whoami, data, row, kind, parent)) {
|
||||
`, [JSON.stringify(ids), max_rowid ?? -1, rowid, kind, parent], function(row) {
|
||||
rows.push(row);
|
||||
});
|
||||
for (let row of rows) {
|
||||
if (await process_message(whoami, data, row, kind, parent)) {
|
||||
modified = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (modified) {
|
||||
break;
|
||||
}
|
||||
|
@ -141,7 +141,6 @@ class TfCollectionsAppElement extends LitElement {
|
||||
}
|
||||
print(message);
|
||||
await tfrpc.rpc.appendMessage(this.whoami, message);
|
||||
return this.shadowRoot.getElementById('docs').load();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
Loading…
Reference in New Issue
Block a user