enhance(repo): add custom name (display name) to repositories - #2
enhance(repo): add custom name (display name) to repositories#2oierxjn wants to merge 7 commits into
Conversation
Add an optional Unicode-friendly display name decoupled from the ASCII repository name used in URLs, git and SSH paths. DisplayName() falls back to the repository name when unset, so existing repositories render unchanged. Assisted-by: deepseek-v4-flash
Allow setting the custom name on repository create/edit and include it in repository payloads. Regenerated the swagger spec. Assisted-by: deepseek-v4-flash
Add the custom name input to the create-repository form and the basic settings form, wired through the existing form handlers. Assisted-by: deepseek-v4-flash
Show DisplayName() in the repository header, the shared repo list (used by explore, profile, org home, forks and more), settings and admin lists, and page/og meta titles. The raw repository name is kept as a tooltip and remains the search identity. Repo search now also matches the custom name. Assisted-by: deepseek-v4-flash
checks-backend's openapi3-check failed because only the Swagger 2.0 spec was regenerated; the OpenAPI 3.0 spec is derived from it. Assisted-by: deepseek-v4-flash
Address Copilot review: the always-on keyword match against custom_name had no test coverage. Extend TestSearchRepository with a Unicode custom name fixture case, mirroring the existing description keyword tests. Assisted-by: deepseek-v4-flash
|
Same branch and content as the upstream PR (go-gitea#39208), for local review. Authored with assistance from deepseek-v4-flash. |
There was a problem hiding this comment.
🔵 Needs a closer look
It includes a database schema migration and public API contract changes across many surfaces, which warrant final human review despite no concrete defects being found.
Pull request overview
This PR adds an optional, Unicode-friendly display name ("custom name") to repositories, decoupled from the ASCII path name used in URLs, git, and SSH. A new CustomName column is added to the repository table (via migration 353), exposed through the create/edit web forms and API, surfaced in the UI (repo header, repo/admin lists, settings, and page/OpenGraph meta), and made searchable. When unset, DisplayName() falls back to the repository name, so behavior is unchanged for existing repos.
Changes:
- Adds
CustomNamefield +DisplayName()fallback helper on the repository model, with a DB migration and repository-search matching onLOWER(custom_name). - Plumbs
custom_namethrough forms, API structs (CreateRepoOption/EditRepoOption/Repository), converters, and web/API create/edit handlers, plus regenerated swagger. - Updates templates to render the display name with the full path name as a tooltip, and adds
en-USlocale strings and unit tests/fixtures.
File summaries
| File | Description |
|---|---|
| models/repo/repo.go | Adds CustomName column and DisplayName() fallback helper (trims whitespace). |
| modelmigration/v28/v353.go | New migration adding the custom_name TEXT column. |
| modelmigration/migrations.go | Registers migration 353 sequentially. |
| models/repo/repo_list.go | Adds LOWER(custom_name) LIKE to keyword search. |
| modules/structs/repo.go | Adds CustomName to API repo structs. |
| services/forms/repo_form.go | Adds CustomName (MaxSize 100) to create/settings forms. |
| services/repository/create.go | Adds CustomName to CreateRepoOptions and persists it. |
| services/convert/repository.go | Maps CustomName into the API response. |
| routers/web/repo/repo.go | Passes CustomName on create. |
| routers/web/repo/setting/setting.go | Updates CustomName on settings save. |
| routers/api/v1/repo/repo.go | Wires CustomName on API create/edit. |
| templates/* | Render DisplayName with FullName tooltip; meta/OpenGraph use display name; add settings/create fields. |
| options/locale/locale_en-US.json | Adds custom_name labels/help text. |
| models/fixtures/repository.yml | Adds a custom name to test_repo_14. |
| models/repo/repo_test.go, repo_list_test.go | Unit tests for DisplayName() and custom-name search. |
| templates/swagger/*.json | Regenerated swagger for the new field. |
Review details
- Files reviewed: 25/25 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Add an optional, Unicode-friendly display name (custom name) for repositories, decoupled from the ASCII path name used in URLs, git and SSH. When unset, everything renders exactly as before.
Usage: repository owners set "Custom name" on the repo settings page (or via
custom_namein the create/edit API). It is shown in the repo header, repo lists, settings/admin lists and page/og meta; URLs, git and SSH keep using the repository name, and the path name stays available as a tooltip. Repo search also matches the custom name.Testing: unit tests cover the DisplayName() fallback and keyword search by custom name; create/edit API plumbing reuses the existing handlers; templates pass the repo's djlint profile. Screenshots will be added once the UI can be run locally (draft).
Mirrors: go-gitea#39208
Implements the human-readable project name request: go-gitea#9032