feat: add reusable links management - #5625
Conversation
There was a problem hiding this comment.
Review summary
The feature is well structured and the backend and frontend pieces line up. New routes are all registered, documented in endpoints.ts, and covered by TestAPIRoutesDocumented (the link.go / /panel/api/links and the /panel/links SPA entry are added). DB wiring is correct: model.Link is added to both the AutoMigrate list in db.go and migrationModels, the established mechanism for a brand-new table. Assignment reuses normalizeExternalLinks for validation and the dedup key (kind plus value) matches the frontend logic. No correctness or security blockers found.
The one item worth resolving before merge is the incomplete translation coverage. Detailed findings are attached as inline comments:
- suggestion: New i18n keys were added only to en-US.json and fa-IR.json; the other 11 locale files are missing them. The repo convention requires a new English key to be mirrored into every locale JSON in internal/web/translation/ (see inline comment on en-US.json).
- suggestion: The links/assign response example documents an 'assigned' field, but the API returns 'attached' (LinkAssignResult.Attached) which is what the frontend reads (see inline comment on endpoints.ts).
- suggestion (optional): AssignLinks runs per-client and per-link queries inside the transaction (N+1); fine for typical use, worth batching for large bulk assignments (see inline comment on link.go).
A minor style note for the maintainer: model.go and api.go add line doc comments, which the stated Go convention discourages, though the surrounding code already uses the same style; left to your discretion.
This review was generated automatically; a maintainer may follow up.
Repo forbids // line comments in committed Go; the Link model and link service read clearly without them.
…nt-clean # Conflicts: # frontend/src/pages/clients/ClientFormModal.tsx
Summary
Adds a dedicated reusable Links management feature, separate from the newer Plugins work. This PR only covers globally managed external share links and remote subscription URLs that can be copied into client external-link lists.
What changed
linkstable and migration wiring for reusable link/subscription records./panel/api/links/*endpoints for listing, creating, updating, deleting, enabling/disabling, reordering, and assigning links to clients.CreateInBatches.frontend/public/openapi.json; the assign example now uses the API fieldattached.Scope
This PR intentionally contains only the Links feature. It does not include the Plugins page, plugin install API, or plugin contract changes from PR #5789.
Testing
go test ./internal/web/controller ./internal/web/service ./internal/databasenpm run buildNote on Claude Bot run
The linked Claude Bot run failed while trying to fetch the PR head into a local branch named
main(git fetch origin --depth=20 pull/5625/head:main) whilemainwas already checked out. That is a checkout/ref-name issue caused by this PR being opened from the fork branch namedmain, not a code/test failure.