~gitpocket/gitpocket

1

fix(profile): show only pinned repositories

commit
1a290ef1833457a6d86b1cc9e13f3451028c0b06 browse tree
parent
64de526a72f53b0b288c7048f66102747da26571
author
obscurejames <354576047+obscurejames@users.noreply.github.com>
signature
Verified ~james signed with a key registered by ~james
date
2026-10-26 23:27 UTC

4 files changed, +6 −8

flow_test.go modified

@@ -278,6 +278,9 @@ func TestPins(t *testing.T) {
278278 r, _ := s.store.CreateRepo(alice, n, "", Public, "")
279279 ids = append(ids, r.ID)
280280 }
281+ if strings.Contains(get(h, "/~alice", "").Body.String(), `href="/~alice/a"`) {
282+ t.Error("unpinned repos shown on the profile")
283+ }
281284 own, _ := s.store.CreateSession(alice.ID)
282285 other, _ := s.store.CreateSession(mallory.ID)
283286 names := map[int64]string{}

templates/org.html modified

@@ -18,7 +18,7 @@
1818 <div class="columns orgbody">
1919 <div class="main">
2020 {{with .Data.Activity}}<section class="activity"><div class="heathead"><p class="muted small">{{.Total}} commit{{if ne .Total 1}}s{{end}} across the organisation {{if .Year}}in {{.Year}}{{else}}in the past 12 months{{end}}</p><nav class="years"><a href="?"{{if not .Year}} class="active"{{end}}>past 12 months</a>{{range .Years}}<a href="?year={{.}}"{{if eq . $.Data.Activity.Year}} class="active"{{end}}>{{.}}</a>{{end}}</nav></div>{{.Grid}}<p class="legend muted small">less <i class="h0"></i><i class="h1"></i><i class="h2"></i><i class="h3"></i><i class="h4"></i> more</p></section>{{end}}
21-{{if .Data.Repos}}<div class="events">{{range .Data.Repos}}{{template "repoitem" .}}{{end}}</div>{{else}}<p class="info">This organisation does not have any repositories.</p>{{end}}
21+{{if .Data.Repos}}<div class="events">{{range .Data.Repos}}{{template "repoitem" .}}{{end}}</div>{{end}}
2222 </div>
2323 <aside class="people">
2424 <h4>People <span class="count">{{len .Data.Members}}</span></h4>

templates/user.html modified

@@ -21,7 +21,7 @@
2121 </aside>
2222 <div class="main">
2323 {{with .Data.Activity}}<section class="activity"><div class="heathead"><p class="muted small">{{.Total}} commit{{if ne .Total 1}}s{{end}} {{if .Year}}in {{.Year}}{{else}}in the past 12 months{{end}}</p><nav class="years"><a href="?"{{if not .Year}} class="active"{{end}}>past 12 months</a>{{range .Years}}<a href="?year={{.}}"{{if eq . $.Data.Activity.Year}} class="active"{{end}}>{{.}}</a>{{end}}</nav></div>{{.Grid}}<p class="legend muted small">less <i class="h0"></i><i class="h1"></i><i class="h2"></i><i class="h3"></i><i class="h4"></i> more</p></section>{{end}}
24-{{if .Data.Repos}}<div class="events">{{range .Data.Repos}}{{template "repoitem" .}}{{end}}</div>{{else}}<p class="info">This user does not have any repositories.</p>{{end}}
24+{{if .Data.Repos}}<div class="events">{{range .Data.Repos}}{{template "repoitem" .}}{{end}}</div>{{end}}
2525 </div>
2626 </div>
2727 {{end}}

web.go modified

@@ -827,12 +827,7 @@ func (s *Server) route(w http.ResponseWriter, r *http.Request) {
827827 if year < 1970 || year > time.Now().Year() {
828828 year = 0
829829 }
830- shown := pinnedRepos(repos, s.store.Pins(owner.ID))
831- pinned := len(shown) > 0
832- if !pinned {
833- shown = repos[:min(len(repos), maxPins)]
834- }
835- data := map[string]any{"Owner": owner, "Repos": shown, "Total": len(repos), "Pinned": pinned, "Profile": profile, "Bio": bio, "Count": len(starred), "Activity": s.activity(owner, year), "Member": member}
830+ data := map[string]any{"Owner": owner, "Repos": pinnedRepos(repos, s.store.Pins(owner.ID)), "Total": len(repos), "Profile": profile, "Bio": bio, "Count": len(starred), "Activity": s.activity(owner, year), "Member": member}
836831 if org {
837832 var people []userHit
838833 for _, m := range s.store.Members(owner.ID) {