Commit 34657cd973

34657cd9733f863edac0d79fd2fb6aa283fd350e

parent: 09b21346c2

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-19 16:14 UTC

httpd: drop the rail's dead pinned-repo loop

Nothing reads rail.Pinned since the dashboard now builds its pinned
column from pinnedRows; railFor ran a PinnedRepos query plus one
AccessRole read per pinned repo on every signed-in page for a value
nothing consumed.

Ref #226
internal/httpd/page.go +1 −17
@@ -3,21 +3,13 @@ package httpd
33import (
44 "net/http"
55
6 "gitbay.org/gitbay/internal/policy"
76 "gitbay.org/gitbay/internal/store"
87)
98
10// railRepo is one pinned repository in the rail.
11type railRepo struct {
12 Owner string
13 Name string
14}
15
169// rail is the viewer's cross-repo state the layout needs. The rail itself
1710// is icons only, so what is left is the unread count on its bell; the
1811// pinned repositories it used to list are rendered by the dashboard.
1912type rail struct {
20 Pinned []railRepo
2113 Unread int
2214}
2315
@@ -61,17 +53,9 @@ func (s *Server) baseFor(viewer store.User) basePage {
6153 return b
6254}
6355
64// railFor collects the viewer's pinned repositories and unread count,
65// dropping anything they may no longer read.
56// railFor collects the viewer's unread count.
6657func (s *Server) railFor(viewer store.User) rail {
6758 var rl rail
68 pinned, _ := s.st.PinnedRepos(viewer.ID)
69 for _, rp := range pinned {
70 grant, _ := s.st.AccessRole(rp.ID, viewer.ID)
71 if policy.CanRead(viewer, rp, grant) {
72 rl.Pinned = append(rl.Pinned, railRepo{Owner: rp.OwnerName, Name: rp.Name})
73 }
74 }
7559 rl.Unread = s.st.UnreadNotices(viewer.ID)
7660 return rl
7761}