ssb: Load more context for mentions.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 16m39s

This commit is contained in:
Cory McWilliams 2024-12-23 13:32:36 -05:00
parent d51b3da1b4
commit 003951fdf7
2 changed files with 15 additions and 9 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&HKGkFsEAu//dKIiim7TsQ6qkx6TRKtvWG/Dj0A3RMIM=.sha256" "previous": "&PP5y+K7wgLxdkeeb4iqyK1Fb+vwS9LjLJDt2FPrVlpo=.sha256"
} }

View File

@ -51,15 +51,21 @@ class TfTabNewsFeedElement extends LitElement {
if (this.hash == '#@') { if (this.hash == '#@') {
result = await tfrpc.rpc.query( 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 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) FROM mentions
JOIN messages ON messages.rowid = messages_fts.rowid JOIN messages_refs ON mentions.id = messages_refs.ref
JOIN json_each(?2) AS following ON messages.author = following.value JOIN messages ON messages_refs.message = messages.id
WHERE UNION
messages.author != ?1 AND SELECT * FROM mentions
messages.timestamp >= ?3 AND
messages.timestamp < ?4
ORDER BY timestamp DESC limit 20
`, `,
[ [
'"' + this.whoami.replace('"', '""') + '"', '"' + this.whoami.replace('"', '""') + '"',