refactor(repo): rename RepoHiddenFolder to HiddenFolder and cleanup
All checks were successful
Build and Release / Create Release (push) Successful in 0s
Build and Release / Unit Tests (push) Successful in 3m2s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 4m58s
Build and Release / Lint (push) Successful in 5m8s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 2m56s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 3m59s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Successful in 4m29s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m17s
Build and Release / Build Binary (linux/arm64) (push) Successful in 10m36s
All checks were successful
Build and Release / Create Release (push) Successful in 0s
Build and Release / Unit Tests (push) Successful in 3m2s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 4m58s
Build and Release / Lint (push) Successful in 5m8s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 2m56s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 3m59s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Successful in 4m29s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m17s
Build and Release / Build Binary (linux/arm64) (push) Successful in 10m36s
Simplify model name from RepoHiddenFolder to HiddenFolder since the repo context is already clear. Update function signatures to use comma-separated bool parameters and fix test calls to include new hidden folder parameters. Replace strings.Split with strings.SplitSeq for better performance.
This commit is contained in:
@@ -192,7 +192,7 @@ func sortTreeViewNodes(nodes []*TreeViewNode) {
|
||||
})
|
||||
}
|
||||
|
||||
func listTreeNodes(ctx context.Context, repoLink string, renderedIconPool *fileicon.RenderedIconPool, commit *git.Commit, tree *git.Tree, treePath, subPath string, hiddenPaths map[string]bool, isAdmin bool, hideDotfiles bool) ([]*TreeViewNode, error) {
|
||||
func listTreeNodes(ctx context.Context, repoLink string, renderedIconPool *fileicon.RenderedIconPool, commit *git.Commit, tree *git.Tree, treePath, subPath string, hiddenPaths map[string]bool, isAdmin, hideDotfiles bool) ([]*TreeViewNode, error) {
|
||||
entries, err := tree.ListEntries()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -237,7 +237,7 @@ func listTreeNodes(ctx context.Context, repoLink string, renderedIconPool *filei
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func GetTreeViewNodes(ctx context.Context, repoLink string, renderedIconPool *fileicon.RenderedIconPool, commit *git.Commit, treePath, subPath string, hiddenPaths map[string]bool, isAdmin bool, hideDotfiles bool) ([]*TreeViewNode, error) {
|
||||
func GetTreeViewNodes(ctx context.Context, repoLink string, renderedIconPool *fileicon.RenderedIconPool, commit *git.Commit, treePath, subPath string, hiddenPaths map[string]bool, isAdmin, hideDotfiles bool) ([]*TreeViewNode, error) {
|
||||
entry, err := commit.GetTreeEntryByPath(treePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -75,7 +75,7 @@ func TestGetTreeViewNodes(t *testing.T) {
|
||||
mockOpenIconForFolder := func(id string) template.HTML {
|
||||
return template.HTML(`<svg class="svg git-entry-icon octicon-file-directory-open-fill" width="16" height="16" aria-hidden="true"><use href="#` + id + `"></use></svg>`)
|
||||
}
|
||||
treeNodes, err := GetTreeViewNodes(ctx, curRepoLink, renderedIconPool, ctx.Repo.Commit, "", "")
|
||||
treeNodes, err := GetTreeViewNodes(ctx, curRepoLink, renderedIconPool, ctx.Repo.Commit, "", "", nil, false, false)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []*TreeViewNode{
|
||||
{
|
||||
@@ -87,7 +87,7 @@ func TestGetTreeViewNodes(t *testing.T) {
|
||||
},
|
||||
}, treeNodes)
|
||||
|
||||
treeNodes, err = GetTreeViewNodes(ctx, curRepoLink, renderedIconPool, ctx.Repo.Commit, "", "docs/README.md")
|
||||
treeNodes, err = GetTreeViewNodes(ctx, curRepoLink, renderedIconPool, ctx.Repo.Commit, "", "docs/README.md", nil, false, false)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []*TreeViewNode{
|
||||
{
|
||||
@@ -107,7 +107,7 @@ func TestGetTreeViewNodes(t *testing.T) {
|
||||
},
|
||||
}, treeNodes)
|
||||
|
||||
treeNodes, err = GetTreeViewNodes(ctx, curRepoLink, renderedIconPool, ctx.Repo.Commit, "docs", "README.md")
|
||||
treeNodes, err = GetTreeViewNodes(ctx, curRepoLink, renderedIconPool, ctx.Repo.Commit, "docs", "README.md", nil, false, false)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []*TreeViewNode{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user