From 003d60c9590a02b8a8955efee46f6cc553c452a0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 19 Jun 2024 14:02:43 -0500 Subject: [PATCH] Don't display posts of disabled user on their profile --- src/controllers/api/accounts.ts | 7 +++++++ src/controllers/api/admin.ts | 1 + src/pipeline.ts | 3 --- src/storages/AdminStore.ts | 2 +- src/views/mastodon/accounts.ts | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/controllers/api/accounts.ts b/src/controllers/api/accounts.ts index 9da0f662..ef828a12 100644 --- a/src/controllers/api/accounts.ts +++ b/src/controllers/api/accounts.ts @@ -180,6 +180,13 @@ const accountStatusesController: AppController = async (c) => { const store = await Storages.db(); + const [user] = await store.query([{ kinds: [30382], authors: [Conf.pubkey], '#d': [pubkey], limit: 1 }], { signal }); + const names = getTagSet(user?.tags, 'n'); + + if (names.has('disabled')) { + return c.json([]); + } + if (pinned) { const [pinEvent] = await store.query([{ kinds: [10001], authors: [pubkey], limit: 1 }], { signal }); if (pinEvent) { diff --git a/src/controllers/api/admin.ts b/src/controllers/api/admin.ts index 003d0cfc..cda4ff61 100644 --- a/src/controllers/api/admin.ts +++ b/src/controllers/api/admin.ts @@ -146,6 +146,7 @@ const adminActionController: AppController = async (c) => { n.silenced = true; } if (data.type === 'suspend') { + n.disabled = true; n.suspended = true; store.remove([{ authors: [authorId] }]).catch(console.warn); } diff --git a/src/pipeline.ts b/src/pipeline.ts index 9f99520b..40ba9c12 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -48,9 +48,6 @@ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise