From 003951fdf767f82a7dc3860f0ce041bc8053197a Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 23 Dec 2024 13:32:36 -0500 Subject: [PATCH] ssb: Load more context for mentions. --- apps/ssb.json | 2 +- apps/ssb/tf-tab-news-feed.js | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index a104647c..68a1bfd6 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&HKGkFsEAu//dKIiim7TsQ6qkx6TRKtvWG/Dj0A3RMIM=.sha256" + "previous": "&PP5y+K7wgLxdkeeb4iqyK1Fb+vwS9LjLJDt2FPrVlpo=.sha256" } diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js index 631a7cc6..a129029d 100644 --- a/apps/ssb/tf-tab-news-feed.js +++ b/apps/ssb/tf-tab-news-feed.js @@ -51,15 +51,21 @@ class TfTabNewsFeedElement extends LitElement { if (this.hash == '#@') { result = await tfrpc.rpc.query( ` + WITH mentions AS (SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature + FROM messages_fts(?1) + JOIN messages ON messages.rowid = messages_fts.rowid + JOIN json_each(?2) AS following ON messages.author = following.value + WHERE + messages.author != ?1 AND + messages.timestamp >= ?3 AND + messages.timestamp < ?4 + ORDER BY timestamp DESC limit 20) SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature - FROM messages_fts(?1) - JOIN messages ON messages.rowid = messages_fts.rowid - JOIN json_each(?2) AS following ON messages.author = following.value - WHERE - messages.author != ?1 AND - messages.timestamp >= ?3 AND - messages.timestamp < ?4 - ORDER BY timestamp DESC limit 20 + FROM mentions + JOIN messages_refs ON mentions.id = messages_refs.ref + JOIN messages ON messages_refs.message = messages.id + UNION + SELECT * FROM mentions `, [ '"' + this.whoami.replace('"', '""') + '"',