From 9e5e7b70d4837351d5b9d2cba77135e7f994f466 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 11 Jan 2024 01:02:47 +0000 Subject: [PATCH] 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 --- apps/blog.json | 2 +- apps/blog/blog.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/blog.json b/apps/blog.json index f1360fba..782fa7bf 100644 --- a/apps/blog.json +++ b/apps/blog.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🪵", - "previous": "&/KFqTPF8mpU1UEFMAsKMtjQxTNTR1W78PIfx+OkCbF0=.sha256" + "previous": "&TIrBnpN3iz3O9L9MCCteAcVJZjA83EKdcfu4SCM76VE=.sha256" } \ No newline at end of file diff --git a/apps/blog/blog.js b/apps/blog/blog.js index 6d14affd..4a3e0866 100644 --- a/apps/blog/blog.js +++ b/apps/blog/blog.js @@ -141,6 +141,7 @@ export function render_atom(blogs) { export async function get_posts() { let blogs = []; + let ids = await ssb.getIdentities(); await ssb.sqlAsync(` WITH blogs AS ( @@ -177,10 +178,11 @@ export async function get_posts() { name IS NOT NULL) WHERE author_rank = 1) SELECT blogs.*, names.name FROM blogs + JOIN json_each(?) AS self ON self.value = blogs.author JOIN public ON public.author = blogs.author LEFT OUTER JOIN names ON names.author = blogs.author ORDER BY blogs.timestamp DESC LIMIT 20 - `, [], function(row) { + `, [JSON.stringify(ids)], function(row) { blogs.push(row); }); return blogs;