diff --git a/apps/ssb.json b/apps/ssb.json index 24de7f3c..95f9a0aa 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&ksxKqT3Bkp0Z2zV2dQU4ttVZ1k16zdWoJVv6R7m5yAQ=.sha256" + "previous": "&NniJybtFHDaypdljDj1kbGIpwU8T5lX9m7+bA1YTu+M=.sha256" } diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index e6e67e89..ecc4f318 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -68,7 +68,10 @@ class TfElement extends LitElement { let ids = (await tfrpc.rpc.getIdentities()) || []; this.whoami = whoami ?? (ids.length ? ids[0] : undefined); this.ids = ids; + await this.load_channels(); + } + async load_channels() { let channels = await tfrpc.rpc.query(` SELECT content ->> 'channel' AS channel, @@ -192,6 +195,14 @@ class TfElement extends LitElement { `, [JSON.stringify(this.following), id] ); + for (let message of messages) { + if (message.author == this.whoami) { + let content = JSON.parse(message.content); + if (content?.type == 'channel') { + this.load_channels(); + } + } + } if (messages && messages.length) { this.unread = [...this.unread, ...messages]; this.unread = this.unread.slice(this.unread.length - 1024); diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js index d93d1e06..64be2884 100644 --- a/apps/ssb/tf-tab-news-feed.js +++ b/apps/ssb/tf-tab-news-feed.js @@ -146,9 +146,10 @@ class TfTabNewsFeedElement extends LitElement { async load_more() { this.loading++; + this.loading_canceled = false; try { let more = []; - while (!more.length) { + while (!more.length && !this.loading_canceled) { let last_start_time = this.start_time; this.start_time = last_start_time - 7 * 24 * 60 * 60 * 1000; more = await this.fetch_messages(this.start_time, last_start_time); @@ -160,6 +161,10 @@ class TfTabNewsFeedElement extends LitElement { } } + cancel_load() { + this.loading_canceled = true; + } + async decrypt(messages) { console.log('decrypt'); let result = []; @@ -254,6 +259,9 @@ class TfTabNewsFeedElement extends LitElement { + Showing ${new Date(this.time_range[0]).toLocaleDateString()} - ${new Date(this.time_range[1]).toLocaleDateString()}.
`; diff --git a/apps/ssb/tf-tab-news.js b/apps/ssb/tf-tab-news.js index 22b109d0..e41431a8 100644 --- a/apps/ssb/tf-tab-news.js +++ b/apps/ssb/tf-tab-news.js @@ -122,14 +122,10 @@ class TfTabNewsElement extends LitElement { show_sidebar() { this.renderRoot.getElementById('sidebar').style.display = 'block'; - this.renderRoot.getElementById('main').style.marginLeft = '2in'; - this.renderRoot.getElementById('show_sidebar').style.display = 'none'; } hide_sidebar() { this.renderRoot.getElementById('sidebar').style.display = 'none'; - this.renderRoot.getElementById('main').style.marginLeft = '0'; - this.renderRoot.getElementById('show_sidebar').style.display = 'block'; } async channel_toggle_subscribed() { @@ -176,8 +172,8 @@ class TfTabNewsElement extends LitElement { `; } return html` -