Let's try only showing my own blog posts.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4755 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2024-01-11 01:02:47 +00:00
parent 2384fc9fa9
commit 9e5e7b70d4
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🪵", "emoji": "🪵",
"previous": "&/KFqTPF8mpU1UEFMAsKMtjQxTNTR1W78PIfx+OkCbF0=.sha256" "previous": "&TIrBnpN3iz3O9L9MCCteAcVJZjA83EKdcfu4SCM76VE=.sha256"
} }

View File

@ -141,6 +141,7 @@ export function render_atom(blogs) {
export async function get_posts() { export async function get_posts() {
let blogs = []; let blogs = [];
let ids = await ssb.getIdentities();
await ssb.sqlAsync(` await ssb.sqlAsync(`
WITH WITH
blogs AS ( blogs AS (
@ -177,10 +178,11 @@ export async function get_posts() {
name IS NOT NULL) name IS NOT NULL)
WHERE author_rank = 1) WHERE author_rank = 1)
SELECT blogs.*, names.name FROM blogs SELECT blogs.*, names.name FROM blogs
JOIN json_each(?) AS self ON self.value = blogs.author
JOIN public ON public.author = blogs.author JOIN public ON public.author = blogs.author
LEFT OUTER JOIN names ON names.author = blogs.author LEFT OUTER JOIN names ON names.author = blogs.author
ORDER BY blogs.timestamp DESC LIMIT 20 ORDER BY blogs.timestamp DESC LIMIT 20
`, [], function(row) { `, [JSON.stringify(ids)], function(row) {
blogs.push(row); blogs.push(row);
}); });
return blogs; return blogs;