Commit 3e18e86aa4

3e18e86aa43773e99f2daad58c8ad7ad0479bcd8

parent: aa02c5e909

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-24 00:47 UTC

dashboard: none under an empty section

Ref #254
internal/control/dashboard.go +13
@@ -175,6 +175,9 @@ func runDashboard(c *Ctx, args []string) int {
175175 fmt.Fprintln(w, "open issues:")
176176 printDashboardItems(w, d.Issues, "#")
177177 fmt.Fprintln(w, "pinned:")
178 if len(d.Pinned) == 0 {
179 fmt.Fprintln(w, " none")
180 }
178181 for _, p := range d.Pinned {
179182 mark := ""
180183 if p.Archived {
@@ -183,10 +186,16 @@ func runDashboard(c *Ctx, args []string) int {
183186 fmt.Fprintf(w, " %s\t%s\t%s%s\n", p.Path, p.Visibility, p.Description, mark)
184187 }
185188 fmt.Fprintln(w, "recent activity:")
189 if len(d.Activity) == 0 {
190 fmt.Fprintln(w, " none")
191 }
186192 for _, e := range d.Activity {
187193 fmt.Fprintf(w, " %s\t%s\t%s\t%s\t%s\n", e.CreatedAt, e.Actor, e.Kind, e.Repo, string(e.Data))
188194 }
189195 fmt.Fprintln(w, "builds:")
196 if len(d.Builds) == 0 {
197 fmt.Fprintln(w, " none")
198 }
190199 for _, b := range d.Builds {
191200 fmt.Fprintf(w, " %s\t%d\t%s\t%s\t%.10s\t%s\n", b.Repo, b.Number, b.Job, b.Status, b.SHA, b.Ref)
192201 }
@@ -229,6 +238,10 @@ func runDashboard(c *Ctx, args []string) int {
229238}
230239
231240func printDashboardItems(w io.Writer, items []DashboardItem, marker string) {
241 if len(items) == 0 {
242 fmt.Fprintln(w, " none")
243 return
244 }
232245 for _, item := range items {
233246 fmt.Fprintf(w, " %s%s%d\t%s\t%s\n", item.Repo, marker, item.Number, item.Title, item.Author)
234247 }
internal/control/dashboard_test.go +17
@@ -4,8 +4,25 @@ import (
44 "bytes"
55 "strings"
66 "testing"
7
8 "gitbay.org/gitbay/internal/protocol"
9 "gitbay.org/gitbay/internal/store"
710)
811
12func TestDashboardEmptySectionsSayNone(t *testing.T) {
13 st, _, uid := newQueueTestRepo(t)
14 c, errOut := pruneCtx(st, t.TempDir(), store.User{ID: uid})
15 if code := Dispatch(c, []string{"dashboard"}); code != protocol.ExitOK {
16 t.Fatalf("exit %d: %s", code, errOut)
17 }
18 out := c.Stdout.(*bytes.Buffer).String()
19 for _, h := range []string{"waiting on your review:", "assigned to you:", "open merge requests:", "open issues:"} {
20 if !strings.Contains(out, h+"\n none\n") {
21 t.Errorf("%q not followed by none:\n%s", h, out)
22 }
23 }
24}
25
926// The push queue is the one worker queue whose worst failure — a key_id
1027// or team_id Apple did not issue, which config validation cannot check —
1128// dead-letters every row on its first attempt with nothing but a log