From bb040f4469db80f7aa3dd987e4caeec980c93729 Mon Sep 17 00:00:00 2001 From: Aviva Ruben Date: Fri, 25 Apr 2025 18:13:35 -0500 Subject: [PATCH] verifications: use constellatio filter and fix labelers commit f2fb9cbade79f4e2dd4a1c07c420691dc6fa827b Author: Aviva Ruben Date: Fri Apr 25 18:13:00 2025 -0500 allow pointer events to make click work commit 519f3841b4abd610a0a9191d8eec0dcaabe75aab Author: Aviva Ruben Date: Fri Apr 25 17:59:54 2025 -0500 show verification mark for labelers commit ca14e1bd8ddd050e79186ac7ba3325853bcd6136 Author: Aviva Ruben Date: Fri Apr 25 17:55:39 2025 -0500 prevent double close buttons commit 88ca6cf41ca9217e8404f45c416e90f1a0121c75 Author: Aviva Ruben Date: Fri Apr 25 17:30:54 2025 -0500 use new 'from_dids' param to filter authors --- .../verification/VerificationsDialog.tsx | 1 - src/components/verification/VerifierDialog.tsx | 2 -- src/screens/Profile/Header/DisplayName.tsx | 18 ++++++++++++++---- src/state/queries/constellation.ts | 10 ++++++++-- src/state/queries/deer-verification.ts | 18 ++++++------------ 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/components/verification/VerificationsDialog.tsx b/src/components/verification/VerificationsDialog.tsx index d61823968..4f8edf4a8 100644 --- a/src/components/verification/VerificationsDialog.tsx +++ b/src/components/verification/VerificationsDialog.tsx @@ -40,7 +40,6 @@ export function VerificationsDialog({ profile={profile} verificationState={verificationState} /> - ) } diff --git a/src/components/verification/VerifierDialog.tsx b/src/components/verification/VerifierDialog.tsx index 01f7e4bd3..5a405dba0 100644 --- a/src/components/verification/VerifierDialog.tsx +++ b/src/components/verification/VerifierDialog.tsx @@ -151,8 +151,6 @@ function Inner({ - - ) } diff --git a/src/screens/Profile/Header/DisplayName.tsx b/src/screens/Profile/Header/DisplayName.tsx index b74c063d4..bed3425db 100644 --- a/src/screens/Profile/Header/DisplayName.tsx +++ b/src/screens/Profile/Header/DisplayName.tsx @@ -1,11 +1,12 @@ import {View} from 'react-native' -import {AppBskyActorDefs, ModerationDecision} from '@atproto/api' +import {type AppBskyActorDefs, type ModerationDecision} from '@atproto/api' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' -import {Shadow} from '#/state/cache/types' -import {atoms as a, useBreakpoints, useTheme} from '#/alf' +import {type Shadow} from '#/state/cache/types' +import {atoms as a, platform, useBreakpoints, useTheme} from '#/alf' import {Text} from '#/components/Typography' +import {VerificationCheckButton} from '#/components/verification/VerificationCheckButton' export function ProfileHeaderDisplayName({ profile, @@ -18,7 +19,7 @@ export function ProfileHeaderDisplayName({ const {gtMobile} = useBreakpoints() return ( - + + + ) diff --git a/src/state/queries/constellation.ts b/src/state/queries/constellation.ts index 5117af8c5..e2909af7c 100644 --- a/src/state/queries/constellation.ts +++ b/src/state/queries/constellation.ts @@ -28,12 +28,17 @@ const headers = new Headers({ const makeReqUrl = ( instance: string, route: string, - params: Record, + params: Record, ) => { const url = new URL(instance) url.pathname = route for (const [k, v] of Object.entries(params)) { - url.searchParams.set(k, v) + // NOTE: in the future this should probably be a repeated param... + if (Array.isArray(v)) { + url.searchParams.set(k, v.join(',')) + } else { + url.searchParams.set(k, v) + } } return url } @@ -46,6 +51,7 @@ export async function* constellationLinks( target: string collection: Collection path: string + from_dids?: string[] }, ) { const url = makeReqUrl(instance, 'links', params) diff --git a/src/state/queries/deer-verification.ts b/src/state/queries/deer-verification.ts index 0975441d7..ac98065a1 100644 --- a/src/state/queries/deer-verification.ts +++ b/src/state/queries/deer-verification.ts @@ -18,7 +18,6 @@ import { asyncGenCollect, asyncGenDedupe, asyncGenFilter, - asyncGenTake, asyncGenTryMap, type ConstellationLink, constellationLinks, @@ -49,17 +48,12 @@ export function getTrustedConstellationVerifications( trusted: Set, ) { const urip = new AtUri(did) - const verificationLinks = asyncGenTake( - constellationLinks(instance, { - target: urip.host, - collection: 'app.bsky.graph.verification', - path: '.subject', - // TODO: remove this when constellation supports filtering - // without a max here, a malicious user could create thousands of verification records and hang a client - // since we can't filter to only trusted verifiers before searching for backlinks yet - }), - 100, - ) + const verificationLinks = constellationLinks(instance, { + target: urip.host, + collection: 'app.bsky.graph.verification', + path: '.subject', + from_dids: Array.from(trusted), + }) return asyncGenDedupe( asyncGenFilter(verificationLinks, ({did}) => trusted.has(did)), ({did}) => did, -- 2.54.0