Skip to content

feat: add links component to profiles - #90

Open
ayhid wants to merge 1 commit into
strapi:developfrom
ayhid:feature/profile-links-schema
Open

ayhid wants to merge 1 commit into
strapi:developfrom
ayhid:feature/profile-links-schema

Conversation

@ayhid

@ayhid ayhid commented Sep 25, 2026

Copy link
Copy Markdown

Part 1 of 6 — profile links. Branched from develop; no dependencies.

Summary

Adds a repeatable profile.link component ({ type, value }, max 10) to api::profile.profile as links, and lets the personal and organization profile endpoints read, write and validate it. This is the data layer for replacing the separate Website / GitHub inputs with a single multi-type Links field.

Why

Members want to list more places they can be found (LinkedIn, X, YouTube, …). One string field per network doesn't scale — see ADR 0003 (docs/adr/0003-profile-links.md) for the data-shape decision.

Changes

  • profile.link component — type enum (website, github, linkedin, x, instagram, youtube, linktree, other), value string (required, max 2048).
  • api::profile.profile — new repeatable links (max 10). website / github are kept for now.
  • utils/profile-links.ts — server-side backstop validation, mirroring what the web form will enforce: social types must be a bare handle matching that network's username rules (e.g. octocat); website/other must be a full http(s):// URL. pickProfileLinks keeps only type + trimmed value per link, so clients can't pass component ids through to the document service; null clears the list.
  • Controllers — links added to userProfileFields / organizationProfileFields and validated via validateProfileData.
  • Services — getProfile populates links; updateProfile (user + organization) returns links in its response.
  • Generated types regenerated (components.d.ts, contentTypes.d.ts).

Test plan

  • pnpm --filter cms --filter web check-types
  • Biome clean on all changed files (pre-existing warnings elsewhere unchanged)
  • pnpm --filter cms build
  • Validation helpers exercised with a scratch script: valid mixed list, null clears, pasted URL in a handle type, invalid URL, unknown type, empty value, 11 links, non-array, extra keys/id stripped
  • PUT /api/users/me/profile with links → response includes links; GET returns them
  • Same for PUT /api/organizations/:id/profile
  • Invalid payloads return 400 with a readable message
  • Content Manager shows the Links component on a Profile

Follow-ups (rest of the stack)

  1. Data migration: copy existing website / github into links (src/migration/, behind ENABLE_MIGRATION)
  2. Web: plain-English labels + hints for Headline / Short bio / Extended bio
  3. Web: link types + per-type validation
  4. Web: Links field in the profile form + save wiring
  5. Web: links on public user / organization pages
  6. Later: remove website / github once the migration has run in production

Deploy note: the migration (part 2) must run in production before part 6 ships, or existing website/GitHub links would briefly disappear from public pages.

Add a repeatable `profile.link` component ({ type, value }, max 10) to
`api::profile.profile`, accept and validate `links` in the user and
organization profile endpoints, and populate it in their responses.

Social types store only the handle; `website`/`other` store a full URL.
The legacy `website`/`github` fields are kept until migrated.

See docs/adr/0003-profile-links.md.
@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

@ayhid is attempting to deploy a commit to the Strapi-Website Team on Vercel.

A member of the Team first needs to authorize it.

@ayhid ayhid mentioned this pull request Sep 25, 2026
5 tasks done

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant