diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-06-19 06:32:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-19 06:32:45 +0800 |
commit | 43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2 (patch) | |
tree | c98c2e1159ee02eb52282811f28a4c31ad222c67 /modules/templates/util_misc.go | |
parent | 17baf1af10de025a47ade1f16f1e5c51646d7fcf (diff) | |
download | gitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.tar.gz gitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.zip |
Refactor names (#31405)
This PR only does "renaming":
* `Route` should be `Router` (and chi router is also called "router")
* `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`)
* Use lower case for private functions to avoid exposing or abusing
Diffstat (limited to 'modules/templates/util_misc.go')
-rw-r--r-- | modules/templates/util_misc.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/templates/util_misc.go b/modules/templates/util_misc.go index 774385483b..d645fa013e 100644 --- a/modules/templates/util_misc.go +++ b/modules/templates/util_misc.go @@ -24,7 +24,7 @@ import ( "github.com/editorconfig/editorconfig-core-go/v2" ) -func SortArrow(normSort, revSort, urlSort string, isDefault bool) template.HTML { +func sortArrow(normSort, revSort, urlSort string, isDefault bool) template.HTML { // if needed if len(normSort) == 0 || len(urlSort) == 0 { return "" @@ -50,8 +50,8 @@ func SortArrow(normSort, revSort, urlSort string, isDefault bool) template.HTML return "" } -// IsMultilineCommitMessage checks to see if a commit message contains multiple lines. -func IsMultilineCommitMessage(msg string) bool { +// isMultilineCommitMessage checks to see if a commit message contains multiple lines. +func isMultilineCommitMessage(msg string) bool { return strings.Count(strings.TrimSpace(msg), "\n") >= 1 } @@ -69,8 +69,8 @@ type Actioner interface { GetIssueInfos() []string } -// ActionIcon accepts an action operation type and returns an icon class name. -func ActionIcon(opType activities_model.ActionType) string { +// actionIcon accepts an action operation type and returns an icon class name. +func actionIcon(opType activities_model.ActionType) string { switch opType { case activities_model.ActionCreateRepo, activities_model.ActionTransferRepo, activities_model.ActionRenameRepo: return "repo" @@ -126,8 +126,8 @@ func ActionContent2Commits(act Actioner) *repository.PushCommits { return push } -// MigrationIcon returns a SVG name matching the service an issue/comment was migrated from -func MigrationIcon(hostname string) string { +// migrationIcon returns a SVG name matching the service an issue/comment was migrated from +func migrationIcon(hostname string) string { switch hostname { case "github.com": return "octicon-mark-github" @@ -177,12 +177,12 @@ func mirrorRemoteAddress(ctx context.Context, m *repo_model.Repository, remoteNa return ret } -func FilenameIsImage(filename string) bool { +func filenameIsImage(filename string) bool { mimeType := mime.TypeByExtension(filepath.Ext(filename)) return strings.HasPrefix(mimeType, "image/") } -func TabSizeClass(ec *editorconfig.Editorconfig, filename string) string { +func tabSizeClass(ec *editorconfig.Editorconfig, filename string) string { if ec != nil { def, err := ec.GetDefinitionForFilename(filename) if err == nil && def.TabWidth >= 1 && def.TabWidth <= 16 { |