[SDK] Validate and brand the persisted account did (#11387)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import {useCallback, useState} from 'react'
|
||||
import {type StyleProp, View, type ViewStyle} from 'react-native'
|
||||
import {type DidString} from '@atproto/syntax'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
import {useMutation} from '@tanstack/react-query'
|
||||
|
||||
@@ -106,8 +105,7 @@ function DialogInner() {
|
||||
reasonType: tools.ozone.report.defs.reasonAppeal.value,
|
||||
subject: {
|
||||
$type: 'com.atproto.admin.defs#repoRef',
|
||||
// the persisted account did is already resolved
|
||||
did: currentAccount.did as DidString,
|
||||
did: currentAccount.did,
|
||||
},
|
||||
reason: details,
|
||||
},
|
||||
|
||||
@@ -567,10 +567,6 @@ export function MessagesList({
|
||||
if (post) {
|
||||
embed = {
|
||||
$type: 'app.bsky.embed.record',
|
||||
/*
|
||||
* `getPost` hands back `uri` and `cid` as plain strings rather
|
||||
* than the branded syntax types the lexicon input declares.
|
||||
*/
|
||||
record: {
|
||||
uri: post.uri,
|
||||
cid: post.cid,
|
||||
|
||||
@@ -71,10 +71,6 @@ function Inner({preferences}: {preferences: UsePreferencesQueryResponse}) {
|
||||
$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,
|
||||
})
|
||||
}, [preferences.postInteractionSettings.threadgateAllowRules])
|
||||
|
||||
@@ -75,7 +75,6 @@ export function StarterPackCard({
|
||||
let followUris: Map<string, string>
|
||||
try {
|
||||
followUris = await bulkWriteFollows(pdsClient, appviewClient, dids, {
|
||||
// the starter pack view is still legacy-typed
|
||||
uri: view.uri,
|
||||
cid: view.cid,
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function bulkWriteFollows(
|
||||
const followRecords: $Typed<app.bsky.graph.follow.Main>[] = dids.map(did => {
|
||||
return {
|
||||
$type: 'app.bsky.graph.follow',
|
||||
// callers hold plain dids read off legacy-typed views
|
||||
// the helper takes the dids as plain strings
|
||||
subject: did as DidString,
|
||||
createdAt: toDatetimeString(new Date()),
|
||||
via,
|
||||
|
||||
@@ -124,7 +124,7 @@ function GermSelfButton({did}: {did: string}) {
|
||||
const {mutate: deleteDeclaration, isPending} = useMutation({
|
||||
mutationFn: async () => {
|
||||
const previousRecord = await pdsClient
|
||||
// the profile view is still legacy-typed, so its did is unbranded
|
||||
// the component takes the did as a plain string prop
|
||||
.get(com.germnetwork.declaration, {
|
||||
repo: did as DidString,
|
||||
rkey: 'self',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {useCallback, useRef, useState} from 'react'
|
||||
import {type TextInput, View} from 'react-native'
|
||||
import {type DidString} from '@atproto/syntax'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
@@ -126,8 +125,7 @@ function DeleteAccountDialogInner({
|
||||
*/
|
||||
await chatClient.call(chat.bsky.actor.deleteAccount)
|
||||
await client.call(com.atproto.server.deleteAccount, {
|
||||
// the persisted account did is already resolved
|
||||
did: currentAccount.did as DidString,
|
||||
did: currentAccount.did,
|
||||
password,
|
||||
token,
|
||||
})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {useCallback, useState} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type DidString} from '@atproto/syntax'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {saveBytesToDisk} from '#/lib/media/manip'
|
||||
@@ -34,7 +33,7 @@ export function ExportCarDialog({
|
||||
}
|
||||
try {
|
||||
setLoading('repo')
|
||||
const did = currentAccount.did as DidString
|
||||
const did = currentAccount.did
|
||||
const data = await pdsClient.call(com.atproto.sync.getRepo, {did})
|
||||
/*
|
||||
* getRepo declares `application/vnd.ipld.car`, so lex-client hands back
|
||||
|
||||
@@ -376,7 +376,6 @@ function Header({
|
||||
let followUris: Map<string, string>
|
||||
try {
|
||||
followUris = await bulkWriteFollows(pdsClient, appviewClient, dids, {
|
||||
// the starter pack view is still legacy-typed
|
||||
uri: starterPack.uri,
|
||||
cid: starterPack.cid,
|
||||
})
|
||||
|
||||
@@ -2,7 +2,6 @@ import {useState} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {KeyboardAwareScrollView} from 'react-native-keyboard-controller'
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||
import {type DidString} from '@atproto/syntax'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
@@ -57,8 +56,7 @@ export function Takendown() {
|
||||
reasonType: tools.ozone.report.defs.reasonAppeal.value,
|
||||
subject: {
|
||||
$type: 'com.atproto.admin.defs#repoRef',
|
||||
// the persisted account did is already resolved
|
||||
did: currentAccount.did as DidString,
|
||||
did: currentAccount.did,
|
||||
},
|
||||
reason: appealText,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user