Skip to content

Commit

Permalink
Validate profile records for views (bluesky-social#3238)
Browse files Browse the repository at this point in the history
validate profile records for views
  • Loading branch information
dholms authored Dec 12, 2024
1 parent a940c3f commit 13636ba
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/bsky/src/hydration/actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
HydrationMap,
RecordInfo,
parseRecord,
parseRecordBytes,
parseString,
safeTakedownRef,
} from './util'
Expand Down Expand Up @@ -116,18 +115,19 @@ export class ActorHydrator {
) {
return acc.set(did, null)
}
const profile =
includeTakedowns || !actor.profile?.takenDown
? actor.profile
: undefined

const profile = actor.profile
? parseRecord<ProfileRecord>(actor.profile, includeTakedowns)
: undefined

return acc.set(did, {
did,
handle: parseString(actor.handle),
profile: parseRecordBytes<ProfileRecord>(profile?.record),
profile: profile?.record,
profileCid: profile?.cid,
profileTakedownRef: safeTakedownRef(profile),
sortedAt: profile?.sortedAt?.toDate(),
indexedAt: profile?.indexedAt?.toDate(),
profileTakedownRef: profile?.takedownRef,
sortedAt: profile?.sortedAt,
indexedAt: profile?.indexedAt,
takedownRef: safeTakedownRef(actor),
isLabeler: actor.labeler ?? false,
allowIncomingChatsFrom: actor.allowIncomingChatsFrom || undefined,
Expand Down

0 comments on commit 13636ba

Please sign in to comment.