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

Layout: unified · split

internal/httpd/page.go +1 −17
@@ -3,21 +3,13 @@ package httpd
3import ( 3import (
4 "net/http" 4 "net/http"
5 5
6 "gitbay.org/gitbay/internal/policy"
7 "gitbay.org/gitbay/internal/store" 6 "gitbay.org/gitbay/internal/store"
8) 7)
9 8
10// railRepo is one pinned repository in the rail.
11type railRepo struct {
12 Owner string
13 Name string
14}
15
16// rail is the viewer's cross-repo state the layout needs. The rail itself 9// rail is the viewer's cross-repo state the layout needs. The rail itself
17// is icons only, so what is left is the unread count on its bell; the 10// is icons only, so what is left is the unread count on its bell; the
18// pinned repositories it used to list are rendered by the dashboard. 11// pinned repositories it used to list are rendered by the dashboard.
19type rail struct { 12type rail struct {
20 Pinned []railRepo
21 Unread int 13 Unread int
22} 14}
23 15
@@ -61,17 +53,9 @@ func (s *Server) baseFor(viewer store.User) basePage {
61 return b 53 return b
62} 54}
63 55
64// railFor collects the viewer's pinned repositories and unread count, 56// railFor collects the viewer's unread count.
65// dropping anything they may no longer read.
66func (s *Server) railFor(viewer store.User) rail { 57func (s *Server) railFor(viewer store.User) rail {
67 var rl rail 58 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 }
75 rl.Unread = s.st.UnreadNotices(viewer.ID) 59 rl.Unread = s.st.UnreadNotices(viewer.ID)
76 return rl 60 return rl
77} 61}