Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Remove repository tab polling and rename Code to Source

cc7faea36a31373079df8fce68c1bc20a44873a0 · Keenan Nemetz · 3d ago · parent 0a12642f

Remove repository tab polling and rename Code to Source

The tab row no longer polls its open counts, so the /{name}/counts endpoint, its htmx trigger, and the badge animation are gone. The unfocused-window note has been removed while the other live regions still pause.

The Code tab is now Source, served at /{name}/source; links, sitemap entries, markdown tree links, and tests follow the new route.

server/ui_test.go +13−13

@@ -71,7 +71,7 @@ func TestRepositoryPagesShareTheTabHeader(t *testing.T) {
71 71 for _, path := range []string{
72 72 "/" + f.repo,
73 73 "/" + f.repo + "/activity",
74 "/" + f.repo + "/code",
74 "/" + f.repo + "/source",
75 75 "/" + f.repo + "/issues",
76 76 "/" + f.repo + "/changes",
77 77 "/" + f.repo + "/releases",
@@ -82,7 +82,7 @@ func TestRepositoryPagesShareTheTabHeader(t *testing.T) {
82 82 if code != 200 {
83 83 t.Fatalf("%s = %d", path, code)
84 84 }
85 for _, want := range []string{`class="repotab`, ">Activity<", ">Code<", ">Issues <span class=\"chip-count\" id=\"repo-issue-count\">0</span><", ">Changes <span class=\"chip-count\" id=\"repo-request-count\">0</span><", ">Releases<", ">Runs<", ">Locks<"} {
85 for _, want := range []string{`class="repotab`, ">Activity<", ">Source<", ">Issues <span class=\"chip-count\" id=\"repo-issue-count\">0</span><", ">Changes <span class=\"chip-count\" id=\"repo-request-count\">0</span><", ">Releases<", ">Runs<", ">Locks<"} {
86 86 if !strings.Contains(body, want) {
87 87 t.Fatalf("%s is missing the %s tab:\n%s", path, want, body)
88 88 }
@@ -128,7 +128,7 @@ func TestRepoTabsCountOpenIssuesAndRequests(t *testing.T) {
128 128
129 129 // The header is shared, so a page that shows nothing but code must carry the
130 130 // same counts as the lists themselves.
131 code, body := f.get("/" + f.repo + "/code")
131 code, body := f.get("/" + f.repo + "/source")
132 132 if code != 200 {
133 133 t.Fatalf("code page = %d", code)
134 134 }
@@ -158,7 +158,7 @@ func TestRepoTabShowsNameAndVisibility(t *testing.T) {
158 158 }
159 159
160 160 f.publish(f.repo)
161 _, body = f.get("/" + f.repo + "/code")
161 _, body = f.get("/" + f.repo + "/source")
162 162 if !strings.Contains(body, `title="Public repository"`) || !strings.Contains(body, ">Overview</a>") {
163 163 t.Fatalf("public repo header does not show the globe state or Overview tab:\n%s", body)
164 164 }
@@ -564,7 +564,7 @@ func TestOverviewAndActivityPages(t *testing.T) {
564 564 t.Fatalf("activity page = %d:\n%s", code, body)
565 565 }
566 566 // Code browsing moved to its own tab, and that page still lists the tree.
567 if code, codePage := f.get("/" + f.repo + "/code"); code != 200 || !strings.Contains(codePage, "main.go") {
567 if code, codePage := f.get("/" + f.repo + "/source"); code != 200 || !strings.Contains(codePage, "main.go") {
568 568 t.Fatalf("code page = %d:\n%s", code, codePage)
569 569 }
570 570 }
@@ -695,7 +695,7 @@ func TestCodeBrowserTreeAndFragments(t *testing.T) {
695 695 t.Fatalf("push: %s", errs)
696 696 }
697 697
698 code, body := f.get("/" + f.repo + "/code")
698 code, body := f.get("/" + f.repo + "/source")
699 699 if code != 200 {
700 700 t.Fatalf("code browser = %d", code)
701 701 }
@@ -728,12 +728,12 @@ func TestCodeBrowserTreeAndFragments(t *testing.T) {
728 728
729 729 // The branch crumb returns to the Code overview, not a second directory
730 730 // listing inside the main pane.
731 resp, fragment = f.htmxGet(t, "/"+f.repo+"/code?ref=main", "")
731 resp, fragment = f.htmxGet(t, "/"+f.repo+"/source?ref=main", "")
732 732 if resp.StatusCode != 200 || !strings.Contains(fragment, `data-mode="overview"`) ||
733 733 !strings.Contains(fragment, "<h1>Code browser</h1>") {
734 734 t.Fatalf("branch crumb fragment = %d:\n%s", resp.StatusCode, fragment)
735 735 }
736 if !strings.Contains(body, `href="/`+f.repo+`/code?ref=main"`) {
736 if !strings.Contains(body, `href="/`+f.repo+`/source?ref=main"`) {
737 737 t.Fatalf("branch crumb does not target the code overview:\n%s", body)
738 738 }
739 739
@@ -767,7 +767,7 @@ func TestCodeBrowserRefPickers(t *testing.T) {
767 767
768 768 // Search and the ref pickers share one row under the page header, and the
769 769 // tag picker lists tags beside the branch picker.
770 code, body := f.get("/" + f.repo + "/code")
770 code, body := f.get("/" + f.repo + "/source")
771 771 if code != 200 {
772 772 t.Fatalf("code page = %d", code)
773 773 }
@@ -786,7 +786,7 @@ func TestCodeBrowserRefPickers(t *testing.T) {
786 786
787 787 // Opening a tag selects it in the tag picker and leaves the branch picker
788 788 // unclaimed rather than pretending the first branch is open.
789 code, body = f.get("/" + f.repo + "/code?ref=v1.0.0")
789 code, body = f.get("/" + f.repo + "/source?ref=v1.0.0")
790 790 if code != 200 {
791 791 t.Fatalf("tag page = %d", code)
792 792 }
@@ -829,7 +829,7 @@ func TestFilterRowsShareOneShape(t *testing.T) {
829 829 }{
830 830 {"/" + f.repo + "/issues", []string{"Label", "Assignee"}},
831 831 {"/" + f.repo + "/activity", []string{"Actor", "Assignee"}},
832 {"/" + f.repo + "/code", []string{"Branch"}},
832 {"/" + f.repo + "/source", []string{"Branch"}},
833 833 } {
834 834 code, body := f.get(row.path)
835 835 if code != 200 {
@@ -858,7 +858,7 @@ func TestFilterRowsShareOneShape(t *testing.T) {
858 858 "/" + f.repo + "/issues",
859 859 "/" + f.repo + "/changes",
860 860 "/" + f.repo + "/search",
861 "/" + f.repo + "/code",
861 "/" + f.repo + "/source",
862 862 } {
863 863 code, body := f.get(path)
864 864 if code != 200 {
@@ -1003,7 +1003,7 @@ func TestFilterRowPutsFiltersBeforeSearch(t *testing.T) {
1003 1003 {"/" + f.repo + "/issues", true},
1004 1004 {"/" + f.repo + "/changes", true},
1005 1005 {"/" + f.repo + "/activity?actor=keenan", true},
1006 {"/" + f.repo + "/code", false},
1006 {"/" + f.repo + "/source", false},
1007 1007 {"/" + f.repo + "/search", false},
1008 1008 } {
1009 1009 code, body := f.get(row.path)