Clean up upsertProfile types
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api'
|
import {
|
||||||
|
AppBskyActorProfile,
|
||||||
|
AppBskyGraphDefs,
|
||||||
|
AppBskyGraphStarterpack,
|
||||||
|
Un$Typed,
|
||||||
|
} from '@atproto/api'
|
||||||
import {SavedFeed} from '@atproto/api/dist/client/types/app/bsky/actor/defs'
|
import {SavedFeed} from '@atproto/api/dist/client/types/app/bsky/actor/defs'
|
||||||
import {TID} from '@atproto/common-web'
|
import {TID} from '@atproto/common-web'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
@@ -142,29 +147,29 @@ export function StepFinished() {
|
|||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
await agent.upsertProfile(async existing => {
|
await agent.upsertProfile(async existing => {
|
||||||
existing = existing ?? {}
|
let next: Un$Typed<AppBskyActorProfile.Record> = existing ?? {}
|
||||||
|
|
||||||
if (blobPromise) {
|
if (blobPromise) {
|
||||||
const res = await blobPromise
|
const res = await blobPromise
|
||||||
if (res.data.blob) {
|
if (res.data.blob) {
|
||||||
existing.avatar = res.data.blob
|
next.avatar = res.data.blob
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (starterPack) {
|
if (starterPack) {
|
||||||
existing.joinedViaStarterPack = {
|
next.joinedViaStarterPack = {
|
||||||
uri: starterPack.uri,
|
uri: starterPack.uri,
|
||||||
cid: starterPack.cid,
|
cid: starterPack.cid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
existing.displayName = ''
|
next.displayName = ''
|
||||||
// HACKFIX
|
// HACKFIX
|
||||||
// creating a bunch of identical profile objects is breaking the relay
|
// creating a bunch of identical profile objects is breaking the relay
|
||||||
// tossing this unspecced field onto it to reduce the size of the problem
|
// tossing this unspecced field onto it to reduce the size of the problem
|
||||||
// -prf
|
// -prf
|
||||||
existing.createdAt = new Date().toISOString()
|
next.createdAt = new Date().toISOString()
|
||||||
return existing
|
return next
|
||||||
})
|
})
|
||||||
|
|
||||||
logEvent('onboarding:finished:avatarResult', {
|
logEvent('onboarding:finished:avatarResult', {
|
||||||
|
|||||||
Reference in New Issue
Block a user