From a618815500508a5d5c9f09d14cf1151886f5300e Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 13 Aug 2025 20:12:27 -0400 Subject: [PATCH] ssb: Fix issues with private messages to one's self. --- apps/ssb.json | 2 +- apps/ssb/tf-app.js | 2 +- apps/ssb/tf-tab-news-feed.js | 21 +-------------------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index 1756cbec..9ac40d61 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&A1H5/wFzj8lTt2HBBb8Gj6tQnx+c2y0LvJnDvZqy10Y=.sha256" + "previous": "&dG2winiXQktKgYn8MEX+K7HUtY7PfYh1a9L9IVdCrtM=.sha256" } diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index 2c57625f..8b9df515 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -385,7 +385,7 @@ class TfElement extends LitElement { ); for (let message of result) { let key = JSON.stringify( - message?.decrypted?.recps?.filter((x) => x != this.whoami)?.sort() + message?.decrypted?.recps?.filter((x) => x != this.whoami)?.sort() ?? [] ); if (!groups[key]) { groups[key] = []; diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js index 85cc7ad6..7927ecdc 100644 --- a/apps/ssb/tf-tab-news-feed.js +++ b/apps/ssb/tf-tab-news-feed.js @@ -209,27 +209,8 @@ class TfTabNewsFeedElement extends LitElement { console.log( `load of ${result.length} rows took ${(t2 - t0) / 1000} (${(t1 - t0) / 1000} to find ${initial_messages.length} initial messages, ${(t2 - t1) / 1000} to find ${result.length} total messages) following=${this.following.length} st=${start_time} et=${end_time}` ); - } else if (this.hash == '#🔐') { - result = await tfrpc.rpc.query( - ` - SELECT TRUE AS is_primary, messages.rowid, messages.id, previous, author, sequence, timestamp, hash, json(content) AS content, signature - FROM messages - JOIN json_each(?1) AS private_messages ON messages.id = private_messages.value - WHERE - (?2 IS NULL OR (messages.timestamp >= ?2)) AND messages.timestamp < ?3 AND - json(messages.content) LIKE '"%' - ORDER BY messages.rowid DESC LIMIT ?4 - `, - [ - JSON.stringify(this.private_messages), - start_time, - end_time, - k_max_results, - ] - ); - result = (await this.decrypt(result)).filter((x) => x.decrypted); } else if (this.hash.startsWith('#🔐')) { - let ids = this.hash.substring('#🔐'.length).split(','); + let ids = this.hash == '#🔐' ? [] : this.hash.substring('#🔐'.length).split(','); result = await tfrpc.rpc.query( ` SELECT TRUE AS is_primary, messages.rowid, messages.id, previous, author, sequence, timestamp, hash, json(content) AS content, signature