Sign in

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

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Open every folder in a change request's file tree

43f98bcd93c6ae44d4a7e20f715408d9d324e201 · Keenan Nemetz · 13d ago · parent 2841d922

Open every folder in a change request's file tree

The review tree folded every directory except the one holding the selected
file, so a change that touched several folders hid most of its files
behind a click each. The tree is an index of what the change touches, so
it should show all of it at once.

Every directory node now starts open. A folder can still be collapsed by
hand, and the browser's tree sync keeps opening the ancestors of a file it
navigates to.

server/web_test.go +22−2

@@ -70,7 +70,10 @@ func TestRequestPageShowsWhatWouldLand(t *testing.T) {
70 70 t.Fatalf("main push: %s", errs)
71 71 }
72 72
73 feature, head := f.cloneWithChange(t, map[string]string{"readme.md": "v1\nfeature line\n"}, "feature")
73 feature, head := f.cloneWithChange(t, map[string]string{
74 "readme.md": "v1\nfeature line\n",
75 "docs/nested.md": "nested in a folder\n",
76 }, "feature")
74 77 if _, errs, err := f.git(feature, "push", f.sshURL(f.repo), "HEAD:refs/heads/feature"); err != nil {
75 78 t.Fatalf("feature push: %s", errs)
76 79 }
@@ -96,15 +99,32 @@ func TestRequestPageShowsWhatWouldLand(t *testing.T) {
96 99 if code != 200 {
97 100 t.Fatalf("request files page = %d", code)
98 101 }
99 for _, want := range []string{"readme.md", "feature line", `class="add"`, `id="review-tree"`} {
102 for _, want := range []string{"readme.md", "docs/nested.md", `id="review-tree"`} {
100 103 if !strings.Contains(body, want) {
101 104 t.Fatalf("request files page does not show %q:\n%s", want, body)
102 105 }
103 106 }
107 // The tree opens every folder: a changed file nested in one is part of the
108 // review index, so it should not need unfolding to be found. Clicking still
109 // collapses the folder in the browser.
110 if !strings.Contains(body, `data-path="docs" open`) || !strings.Contains(body, "nested in a folder") {
111 t.Fatalf("the review tree hid a file in a collapsed folder:\n%s", body)
112 }
104 113 // The Files tab is the approval surface, so it must not need a clone.
105 114 if strings.Contains(body, "No changes, or the head is not reachable") {
106 115 t.Fatalf("request files page found no diff for a branch with a change:\n%s", body)
107 116 }
117 // Each file is a review of its own: the top of the list is selected by default,
118 // and any other row opens the same surface.
119 code, body = f.get("/r/" + f.repo + "/requests/" + reqID + "/files/readme.md")
120 if code != 200 {
121 t.Fatalf("request file page = %d", code)
122 }
123 for _, want := range []string{"feature line", `class="add"`} {
124 if !strings.Contains(body, want) {
125 t.Fatalf("the readme review does not show %q:\n%s", want, body)
126 }
127 }
108 128 }
109 129
110 130 // TestMergedRequestStillShowsWhatLanded: landing moves the base to include the head,