feat(profile): add contributor profiles - #1082
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| name, | ||
| profileUrl: validatedProfileUrl(account.profileUrl), | ||
| }; | ||
| const attribution = await resolveContributorAttribution(userId); |
There was a problem hiding this comment.
resolveContributorAttribution no longer checks showInCredits (it only gates on isPublic/isModeratorHidden/isActive/deletedAt, see contributor-profile.ts resolveContributorAttribution). The old code here explicitly required account.showInCredits before returning a profile URL. Now a contributor who turns off "show in credits" (but leaves the profile public) will still have their photo attributions link to /contributor/<slug> — attributionProfileUrl is rendered publicly in EntityPhotoGallery.svelte/BuildingResult.svelte. This contradicts CONTRIBUTING.md: "Credits visibility is separate from profile visibility. Turning credits off removes the account from public contributor credits without deleting the profile." getEditorCredits() is safe because its SQL already filters WHERE u.show_in_credits = true before calling this resolver, but photo attribution has no such filter.
| }); | ||
| if (!accountRes.ok) { | ||
| const accountData = (await accountRes.json().catch(() => ({}))) as { error?: string }; | ||
| profileError = accountData.error ?? 'Profile saved, but account photo could not be saved.'; |
There was a problem hiding this comment.
If the avatar PATCH fails here, the function returns without calling setProfileDraft(data) (line 289), even though the PUT /api/contributors/me call right before it already committed the bio/visibility/social-link changes server-side and bumped version. The local contributorProfile.version stays stale, so the next save attempt will hit a 409 conflict purely because of this failure path, forcing the user to "Reload server profile" even though their own edit succeeded. Consider calling setProfileDraft(data as EditableProfile) before attempting the avatar PATCH, so local state tracks the version that was actually persisted.
|
Reviewed the contributor profiles feature. Two issues found, left as inline comments:
Rest of the change (auth checks on admin moderation routes, optimistic-concurrency version handling, URL/host allowlists for social links, rate limiting, audit trail) looks solid. |
dac62b2 to
5862dc1
Compare
Summary
/contributor/[slug].Closes #310
Verification
bun run check: 0 errors.bun run db:generate: no pending schema changes.git diff --check: passed.src/...assets are absent.DATABASE_URL, which is not configured in this workspace..cursordiagnostics.