[SDK] Validate and brand the persisted account did (#11387)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-13 22:26:22 +03:00
committed by GitHub
parent 9fe0084874
commit 3677c98873
46 changed files with 154 additions and 205 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
import {useCallback, useEffect, useState} from 'react'
import {View} from 'react-native'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {type DidString} from '@atproto/syntax'
import {useLingui} from '@lingui/react/macro'
import {useQueryClient} from '@tanstack/react-query'
@@ -69,7 +68,7 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
const {accounts} = useSession()
const client = useAppviewClient()
useEffect(() => {
const actors = accounts.map(acc => acc.did as DidString)
const actors = accounts.map(acc => acc.did)
if (actors.length === 0) return
void queryClient.prefetchQuery({
queryKey: profilesQueryKey(actors),
@@ -143,10 +143,6 @@ export function useSaveDraftMutation() {
{appviewClient: client, chatClient},
composerState,
)
/*
* `composerStateToDraft` builds the draft with unbranded string fields,
* so it is asserted once here to the generated input type.
*/
const draft = apiDraft
logger.debug('saving draft', {
-8
View File
@@ -321,10 +321,6 @@ export function composerReducer(
posts,
postgate: createPostgateRecord({
post: '',
/*
* Draft records are still typed against the legacy client, so the
* stored rules arrive unbranded. Wave B migrates the draft types.
*/
embeddingRules: postgateEmbeddingRules,
}),
threadgate: threadgateRecordToAllowUISetting({
@@ -750,10 +746,6 @@ export function createComposerState({
],
postgate: createPostgateRecord({
post: '',
/*
* Preferences are still typed against the legacy client, so the stored
* rules arrive unbranded. Wave B migrates `getPreferences`.
*/
embeddingRules: initInteractionSettings?.postgateEmbeddingRules || [],
}),
threadgate: threadgateRecordToAllowUISetting({
@@ -86,10 +86,6 @@ export function ThreadgateBtn({
$type: 'app.bsky.feed.threadgate',
post: '' as AtUriString,
createdAt: toDatetimeString(new Date()),
/*
* Preferences are still typed against the legacy client, so the stored
* rules arrive unbranded. Wave B migrates `getPreferences`.
*/
allow: preferences?.postInteractionSettings.threadgateAllowRules,
})
const prefPostgate = createPostgateRecord({
@@ -9,7 +9,7 @@ import {
View,
} from 'react-native'
import {TID} from '@atproto/common-web'
import {AtUri, type DidString} from '@atproto/syntax'
import {AtUri} from '@atproto/syntax'
import {
moderateProfile,
type ModerationDecision,
@@ -913,9 +913,7 @@ function SayHelloBtn({profile}: {profile: app.bsky.actor.defs.ProfileView}) {
try {
setIsLoading(true)
const data = await client.call(chat.bsky.convo.getConvoForMembers, {
// both dids are already resolved - one from the profile view, one from
// the active session
members: [profile.did, currentAccount!.did] as DidString[],
members: [profile.did, currentAccount!.did],
})
navigation.navigate('MessagesConversation', {
conversation: data.convo.id,
+1 -1
View File
@@ -341,7 +341,7 @@ export const DebugModScreen = ({}: NativeStackScreenProps<
blockingByList: undefined,
}),
})
mockedProfile.did = did as app.bsky.actor.defs.ProfileViewBasic['did']
mockedProfile.did = did
mockedProfile.avatar = 'https://bsky.social/about/images/favicon-32x32.png'
// @ts-expect-error ProfileViewBasic is close enough -esb
mockedProfile.banner =