feat(import): import legacy person avatars (#130)#143
Open
themightychris wants to merge 3 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Legacy users showed initials where their codeforphilly.org photo used to be — the importer brought blog media but never person avatars. A spike found the source: person.PrimaryPhotoID → GET /media/<id>. (Projects have no image field in laddr, so this is avatars only.) RawPersonSchema now parses PrimaryPhotoID. For each person with one, the importer fetches /media/<id>, runs it through the existing processAvatar (square original + 128px thumb), stores both as gitsheets attachments (avatar.jpg + avatar-128.jpg), and sets avatarKey — the same convention as the avatar-upload route. Reuses the blog-media machinery (fetchMediaBytes + BlobObject.write + setAttachments), concurrency 4, failures non-fatal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the #130 leadership-feedback item — legacy users showed initials where their codeforphilly.org photo used to be.
Spike result
Probed the live laddr API: a person's photo is
person.PrimaryPhotoID→GET /media/<id>(confirmed 200,image/jpeg). Projects have no image field in laddr, so this is person avatars only (no project art to import).What
RawPersonSchemanow parsesPrimaryPhotoID./media/<id>, runs it through the existingprocessAvatar(square original + 128px thumb), stores both as gitsheets attachments (avatar.jpg+avatar-128.jpg), and setsavatarKey = people/<slug>/avatar.jpg— the same convention asPOST /api/people/:slug/avatar.fetchMediaBytes+BlobObject.write+setAttachments), concurrency 4, failures non-fatal (the person still imports).No spec change — the avatar storage contract already exists; this just populates it at import time.
Tests
New importer case: a person with
PrimaryPhotoIDgets the two avatar attachments +avatarKey; one without gets neither. import-laddr 37/37, type-check + lint clean.Note
Many photo-bearing accounts are spam, but the spam-prune (#133) removes them downstream — net imported avatars skew to real members. (import → prune ordering is documented in spam-detection.md.)
🤖 Generated with Claude Code