mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-21 00:36:08 +00:00
65248945c9
Clarify when "string" should be used (and be escaped), and when "template.HTML" should be used (no need to escape) And help PRs like #29059 , to render the error messages correctly. (cherry picked from commit f3eb835886031df7a562abc123c3f6011c81eca8) Conflicts: modules/web/middleware/binding.go routers/web/feed/convert.go tests/integration/branches_test.go tests/integration/repo_branch_test.go trivial context conflicts
30 lines
787 B
Go
30 lines
787 B
Go
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package types
|
|
|
|
import "code.gitea.io/gitea/modules/translation"
|
|
|
|
type OwnerType string
|
|
|
|
const (
|
|
OwnerTypeSystemGlobal = "system-global"
|
|
OwnerTypeIndividual = "individual"
|
|
OwnerTypeRepository = "repository"
|
|
OwnerTypeOrganization = "organization"
|
|
)
|
|
|
|
func (o OwnerType) LocaleString(locale translation.Locale) string {
|
|
switch o {
|
|
case OwnerTypeSystemGlobal:
|
|
return locale.TrString("concept_system_global")
|
|
case OwnerTypeIndividual:
|
|
return locale.TrString("concept_user_individual")
|
|
case OwnerTypeRepository:
|
|
return locale.TrString("concept_code_repository")
|
|
case OwnerTypeOrganization:
|
|
return locale.TrString("concept_user_organization")
|
|
}
|
|
return locale.TrString("unknown")
|
|
}
|