forked from cory/tildefriends
Trying to work toward multiple users. List wikis of people you are following. Also hook in to the lit updated event.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4626 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -127,10 +127,11 @@ async function process_message(whoami, collection, message, kind, parent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
tfrpc.register(async function collection(ids, kind, parent, max_rowid, data) {
|
||||
tfrpc.register(async function collection(ids, kind, parent, max_rowid, data, include_private) {
|
||||
let whoami = await ssb.getIdentities();
|
||||
data = data ?? {};
|
||||
let rowid = 0;
|
||||
let first = true;
|
||||
await ssb.sqlAsync('SELECT MAX(rowid) AS rowid FROM messages', [], function(row) {
|
||||
rowid = row.rowid;
|
||||
});
|
||||
@ -140,10 +141,12 @@ tfrpc.register(async function collection(ids, kind, parent, max_rowid, data) {
|
||||
await ssb.sqlAsync('SELECT MAX(rowid) AS rowid FROM messages', [], function(row) {
|
||||
rowid = row.rowid;
|
||||
});
|
||||
first = false;
|
||||
}
|
||||
|
||||
let modified = false;
|
||||
let rows = [];
|
||||
print(include_private ? true: false, ids);
|
||||
await ssb.sqlAsync(`
|
||||
SELECT messages.id, author, content, timestamp
|
||||
FROM messages
|
||||
@ -153,17 +156,18 @@ tfrpc.register(async function collection(ids, kind, parent, max_rowid, data) {
|
||||
messages.rowid <= ?3 AND
|
||||
((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) {
|
||||
(?6 AND content LIKE '"%'))
|
||||
`, [JSON.stringify(ids), max_rowid ?? -1, rowid, kind, parent, include_private ? true : false], function(row) {
|
||||
rows.push(row);
|
||||
});
|
||||
print('done');
|
||||
max_rowid = rowid;
|
||||
for (let row of rows) {
|
||||
if (await process_message(whoami, data, row, kind, parent)) {
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
if (first || modified) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user