diff --git a/apps/wiki.json b/apps/wiki.json
index cd04a522..ee815625 100644
--- a/apps/wiki.json
+++ b/apps/wiki.json
@@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "📝",
- "previous": "&N1wA9DJ6RacaPG52I+ZEhWbbVvf3U1Dcvouh0UkfkG0=.sha256"
+ "previous": "&YeaTOrnB4mPU2htPCtcLH9Ys1rXyyulEroR2gkU7zKw=.sha256"
}
\ No newline at end of file
diff --git a/apps/wiki/app.js b/apps/wiki/app.js
index 045cc284..187a9675 100644
--- a/apps/wiki/app.js
+++ b/apps/wiki/app.js
@@ -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;
}
}
diff --git a/apps/wiki/tf-collections-app.js b/apps/wiki/tf-collections-app.js
index cb47d6e0..5a600a1b 100644
--- a/apps/wiki/tf-collections-app.js
+++ b/apps/wiki/tf-collections-app.js
@@ -41,10 +41,18 @@ class TfCollectionsAppElement extends LitElement {
async read_wikis() {
let max_rowid;
let wikis;
+ let start_whoami = this.whoami;
while (true)
{
- console.log('read_wikis', max_rowid);
- [max_rowid, wikis] = await tfrpc.rpc.collection(this.owner_ids, 'wiki', undefined, max_rowid, wikis);
+ console.log('read_wikis', this.whoami);
+ let following = Object.keys(await tfrpc.rpc.following([this.whoami]), 2);
+ console.log('following', following);
+ [max_rowid, wikis] = await tfrpc.rpc.collection(following, 'wiki', undefined, max_rowid, wikis, false);
+ console.log('read ->', wikis);
+ if (this.whoami !== start_whoami) {
+ break;
+ }
+ console.log('wikis =>', wikis);
this.wikis = wikis;
this.update_wiki();
}
@@ -59,10 +67,8 @@ class TfCollectionsAppElement extends LitElement {
let wiki_docs;
while (true)
{
- console.log('read_wiki_docs', max_rowid);
[max_rowid, wiki_docs] = await tfrpc.rpc.collection(this.owner_ids, 'wiki-doc', this.wiki?.id, max_rowid, wiki_docs);
if (this.wiki?.id !== start_id) {
- console.log('ending read_wiki_docs');
break;
}
this.wiki_docs = wiki_docs;
@@ -188,6 +194,14 @@ class TfCollectionsAppElement extends LitElement {
this.update_hash();
}
+ updated(changed_properties) {
+ if (changed_properties.has('whoami')) {
+ this.wikis = {};
+ this.wiki_docs = {};
+ this.read_wikis();
+ }
+ }
+
render() {
let self = this;
return html`
@@ -195,14 +209,14 @@ class TfCollectionsAppElement extends LitElement {