From 805cc46acec32d3b0d8f6f3dce9feb5af8da0f3b Mon Sep 17 00:00:00 2001 From: Kuba Suder Date: Sun, 24 May 2026 23:59:20 +0200 Subject: [PATCH] detect and show if a post's author has needs-review --- src/api/bluesky_api.ts | 10 +++++++ src/components/posts/HiddenRepliesLink.svelte | 30 +++++++++---------- src/components/posts/PostComponent.svelte | 14 +++++++++ src/models/posts.js | 6 ++++ 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/src/api/bluesky_api.ts b/src/api/bluesky_api.ts index 9a0fccd..8d4fcdb 100644 --- a/src/api/bluesky_api.ts +++ b/src/api/bluesky_api.ts @@ -7,6 +7,8 @@ import { parseBlueskyPostURL } from '../router.js'; export { APIError }; +export const blueskyLabellerDID = 'did:plc:ar7c4by46qjdydhdevvrndac'; + /** * Thrown when the response is technically a "success" one, but the returned data is not what it should be. */ @@ -126,6 +128,14 @@ export class BlueskyAPI extends Minisky { return await this.getRequest('app.bsky.feed.searchPosts', params); } + async checkIfProfileHasNeedsReview(did: string): Promise { + let profile = await this.getRequest('app.bsky.actor.getProfile', { actor: did }, + { headers: { 'atproto-accept-labelers': blueskyLabellerDID }} + ); + + return profile.labels?.some((x: json) => (x.src == blueskyLabellerDID && x.val == 'needs-review')); + } + async loadHiddenReplyURIs(post: Post): Promise { let [constellationReplies, blueReplies] = await Promise.all([ constellationAPI.getReplies(post.uri), diff --git a/src/components/posts/HiddenRepliesLink.svelte b/src/components/posts/HiddenRepliesLink.svelte index 6f25c93..7abbd23 100644 --- a/src/components/posts/HiddenRepliesLink.svelte +++ b/src/components/posts/HiddenRepliesLink.svelte @@ -1,5 +1,5 @@