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",
|
"type": "tildefriends-app",
|
||||||
"emoji": "📝",
|
"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') {
|
if (typeof content == 'string') {
|
||||||
let x;
|
let x;
|
||||||
for (let id of whoami) {
|
for (let id of whoami) {
|
||||||
x = await tfrpc.rpc.try_decrypt(whoami, content);
|
x = await ssb.privateMessageDecrypt(id, content);
|
||||||
if (x) {
|
if (x) {
|
||||||
content = JSON.parse(x);
|
content = JSON.parse(x);
|
||||||
content.draft = true;
|
content.draft = true;
|
||||||
@ -105,18 +105,19 @@ async function process_message(whoami, collection, message, kind, parent) {
|
|||||||
if (!x) {
|
if (!x) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (content.type !== type ||
|
if (content.type !== kind ||
|
||||||
(parent && content.parent !== parent)) {
|
(parent && content.parent !== parent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content.draft = false;
|
content.draft = false;
|
||||||
}
|
}
|
||||||
|
print(message.id, content);
|
||||||
if (content?.key) {
|
if (content?.key) {
|
||||||
if (content?.tombstone) {
|
if (content?.tombstone) {
|
||||||
delete collection[content.key];
|
delete collection[content.key];
|
||||||
} else if (collection[content.key]) {
|
} else {
|
||||||
collection[content.key] = Object.assign(collection[content.key], content);
|
collection[content.key] = Object.assign(collection[content.key] || {}, content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
collection[message.id] = Object.assign(content, {id: message.id});
|
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 modified = false;
|
||||||
|
let rows = [];
|
||||||
await ssb.sqlAsync(`
|
await ssb.sqlAsync(`
|
||||||
SELECT messages.id, author, content, timestamp
|
SELECT messages.id, author, content, timestamp
|
||||||
FROM messages
|
FROM messages
|
||||||
@ -150,11 +152,14 @@ tfrpc.register(async function collection(ids, kind, parent, max_rowid, data) {
|
|||||||
((json_extract(messages.content, '$.type') = ?4 AND
|
((json_extract(messages.content, '$.type') = ?4 AND
|
||||||
(?5 IS NULL OR json_extract(messages.content, '$.parent') = ?5)) OR
|
(?5 IS NULL OR json_extract(messages.content, '$.parent') = ?5)) OR
|
||||||
content LIKE '"%')
|
content LIKE '"%')
|
||||||
`, [JSON.stringify(ids), max_rowid ?? -1, rowid, kind, parent], function(row) {
|
`, [JSON.stringify(ids), max_rowid ?? -1, rowid, kind, parent], function(row) {
|
||||||
if (process_message(whoami, data, row, kind, parent)) {
|
rows.push(row);
|
||||||
|
});
|
||||||
|
for (let row of rows) {
|
||||||
|
if (await process_message(whoami, data, row, kind, parent)) {
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
if (modified) {
|
if (modified) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,6 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
}
|
}
|
||||||
print(message);
|
print(message);
|
||||||
await tfrpc.rpc.appendMessage(this.whoami, message);
|
await tfrpc.rpc.appendMessage(this.whoami, message);
|
||||||
return this.shadowRoot.getElementById('docs').load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user