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",
"emoji": "🦀",
"previous": "&HKGkFsEAu//dKIiim7TsQ6qkx6TRKtvWG/Dj0A3RMIM=.sha256"
"previous": "&PP5y+K7wgLxdkeeb4iqyK1Fb+vwS9LjLJDt2FPrVlpo=.sha256"
}

View File

@ -51,7 +51,7 @@ class TfTabNewsFeedElement extends LitElement {
if (this.hash == '#@') {
result = await tfrpc.rpc.query(
`
SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
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
@ -59,7 +59,13 @@ class TfTabNewsFeedElement extends LitElement {
messages.author != ?1 AND
messages.timestamp >= ?3 AND
messages.timestamp < ?4
ORDER BY timestamp DESC limit 20
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 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('"', '""') + '"',