Skip to content

feat: add reusable links management - #5625

Draft
saeedhasani wants to merge 3 commits into
MHSanaei:mainfrom
saeedhasani:main
Draft

feat: add reusable links management#5625
saeedhasani wants to merge 3 commits into
MHSanaei:mainfrom
saeedhasani:main

Conversation

@saeedhasani

@saeedhasani saeedhasani commented Jun 28, 2026

Copy link
Copy Markdown

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

  • Add a links table and migration wiring for reusable link/subscription records.
  • Add /panel/api/links/* endpoints for listing, creating, updating, deleting, enabling/disabling, reordering, and assigning links to clients.
  • Add a Links page to the sidebar with CRUD controls, bulk enable/disable/delete, ordering, and assignment to existing clients.
  • Add client-form integration so admins can select managed links/subscriptions when editing a client.
  • Batch the assign path by loading existing client external links once and creating new rows with CreateInBatches.
  • Add API docs and regenerate frontend/public/openapi.json; the assign example now uses the API field attached.
  • Add Links i18n keys to all 13 locale files.

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/database
  • npm run build

Note 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) while main was already checked out. That is a checkout/ref-name issue caused by this PR being opened from the fork branch named main, not a code/test failure.

@github-actions github-actions Bot added enhancement New feature or request go Pull requests that update Go code javascript Pull requests that update javascript code labels Jun 28, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/web/translation/en-US.json
Comment thread frontend/src/pages/api-docs/endpoints.ts Outdated
Comment thread internal/web/service/link.go
@MHSanaei
MHSanaei marked this pull request as draft June 29, 2026 10:54
@saeedhasani
saeedhasani marked this pull request as ready for review July 4, 2026 09:36
@saeedhasani saeedhasani changed the title feat: add reusable external links management feat: add reusable links management Jul 4, 2026
Repository owner deleted a comment from github-actions Bot Jul 4, 2026
Repo forbids // line comments in committed Go; the Link model and link service read clearly without them.
@MHSanaei
MHSanaei marked this pull request as draft July 8, 2026 23:57
…nt-clean

# Conflicts:
#	frontend/src/pages/clients/ClientFormModal.tsx
@saeedhasani
saeedhasani marked this pull request as ready for review July 9, 2026 05:05
Repository owner deleted a comment from github-actions Bot Jul 9, 2026
@MHSanaei
MHSanaei marked this pull request as draft July 28, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants