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/request_files.go +6−4

@@ -45,6 +45,11 @@ func reviewFileStatus(f diffFile) string {
45 45 // buildReviewTree folds the changed paths into the same nested shape the code
46 46 // browser uses. Only changed files are present, so the tree stays an index of
47 47 // the review rather than a second copy of the repository.
48 //
49 // Every directory starts open. The tree is an index of what the change touches, and
50 // a reviewer looking for a file should not have to unfold each folder to find out
51 // whether something is in it; a folder can still be collapsed by hand, and the tree
52 // opens the way back to the selected file when a link moves it.
48 53 func buildReviewTree(files []diffFile, active string) []*treeNode {
49 54 root := &treeNode{Type: "tree"}
50 55 for _, f := range files {
@@ -72,12 +77,9 @@ func buildReviewTree(files []diffFile, active string) []*treeNode {
72 77 }
73 78 }
74 79 if next == nil {
75 next = &treeNode{Name: part, Path: nodePath, Type: "tree"}
80 next = &treeNode{Name: part, Path: nodePath, Type: "tree", Open: true}
76 81 cur.Children = append(cur.Children, next)
77 82 }
78 if active == nodePath || strings.HasPrefix(active, nodePath+"/") {
79 next.Open = true
80 }
81 83 cur = next
82 84 }
83 85 }