ssb: An experiment in including hashtag mentions in channel content. Also sort the channel list like I thought I already did.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 16m54s

This commit is contained in:
Cory McWilliams 2024-12-04 20:50:46 -05:00
parent 10b15896b3
commit 8a27c45ab1
3 changed files with 19 additions and 9 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🐌", "emoji": "🐌",
"previous": "&CYrIO97YKzR9kzp6sfWVx0g+xah9iuF8BlOg9EDMgMk=.sha256" "previous": "&+H2UcjXWpt50AtiIz8Uac38RJgLshQ0lAAH8Gb5/DNs=.sha256"
} }

View File

@ -91,7 +91,7 @@ class TfElement extends LitElement {
delete channel_map[row.channel]; delete channel_map[row.channel];
} }
} }
this.channels = Object.keys(channel_map); this.channels = Object.keys(channel_map).sort();
} }
set_hash(hash) { set_hash(hash) {

View File

@ -80,13 +80,13 @@ class TfTabNewsFeedElement extends LitElement {
tfrpc.rpc.query( tfrpc.rpc.query(
` `
WITH news AS (SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature WITH news 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 FROM messages
JOIN json_each(?) AS following ON messages.author = following.value JOIN json_each(?) AS following ON messages.author = following.value
WHERE WHERE
messages.timestamp > ? AND messages.timestamp > ? AND
messages.timestamp < ? AND messages.timestamp < ? AND
messages.content ->> 'channel' = ? messages.content ->> 'channel' = ?
ORDER BY messages.timestamp DESC) ORDER BY messages.timestamp DESC)
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 news FROM news
JOIN messages_refs ON news.id = messages_refs.ref JOIN messages_refs ON news.id = messages_refs.ref
@ -97,6 +97,15 @@ class TfTabNewsFeedElement extends LitElement {
JOIN messages_refs ON news.id = messages_refs.message JOIN messages_refs ON news.id = messages_refs.message
JOIN messages ON messages_refs.ref = messages.id JOIN messages ON messages_refs.ref = messages.id
UNION UNION
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(?5)
JOIN messages ON messages.rowid = messages_fts.rowid
JOIN json_each(?1) AS following ON messages.author = following.value
JOIN json_tree(messages.content, '$.mentions') AS mention ON mention.value = '#' || ?4
WHERE
messages.timestamp > ?2 AND
messages.timestamp < ?3
UNION
SELECT news.* FROM news SELECT news.* FROM news
`, `,
[ [
@ -104,6 +113,7 @@ class TfTabNewsFeedElement extends LitElement {
start_time, start_time,
end_time, end_time,
this.hash.substring(2), this.hash.substring(2),
'"#' + this.hash.substring(2).replace('"', '""') + '"',
] ]
) )
); );