Stop hard-coding 'arne/' as the owner prefix #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
web/templates/home.htmlhard-codes the stringarne/as the owner prefix in every project-row entry. This works because orbit is single-user today, but the owner is already available on the handler (Handler.owner, set at construction inmain.gofrom theORBIT_FORGEJO_OWNERenvironment variable). Threading it through to the template is a two-line change.Two options worth considering:
Owner stringandProjects []projectSummary, passing that to the template instead of the raw slice.ownerfunction in the template funcmap that returnsh.owner.The view-struct approach is more explicit and easier to extend when the home page grows more top-level fields. The funcmap approach is a one-liner in the handler but leaves the template implicitly coupled to the handler's funcmap.
Scope
In bounds: the home-page template and its handler. Out of bounds: anywhere else
arne/might be hard-coded (the project detail page doesn't display the owner at all, so it's unaffected).web: thread owner through to templates instead of hard-coding 'arne/'to Stop hard-coding 'arne/' as the owner prefix