mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-24 05:39:46 +02:00
Refactor repo unit "disabled" check (#31389)
1. There are already global "unit consts", no need to use context data, which is fragile 2. Remove the "String()" method from "unit", it would only cause rendering problems in templates --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
1 parent
d32648b204
commit
37a4b233a0
11 files changed
+25
-55
No files matched your search
+1
-1
@@ -362,7 +362,7 @@ func (repo *Repository) LoadUnits(ctx context.Context) (err error) {
|
||||
if log.IsTrace() {
|
||||
unitTypeStrings := make([]string, len(repo.Units))
|
||||
for i, unit := range repo.Units {
|
||||
unitTypeStrings[i] = unit.Type.String()
|
||||
unitTypeStrings[i] = unit.Type.LogString()
|
||||
}
|
||||
log.Trace("repo.Units, ID=%d, Types: [%s]", repo.ID, strings.Join(unitTypeStrings, ", "))
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func IsErrUnitTypeNotExist(err error) bool {
|
||||
}
|
||||
|
||||
func (err ErrUnitTypeNotExist) Error() string {
|
||||
return fmt.Sprintf("Unit type does not exist: %s", err.UT.String())
|
||||
return fmt.Sprintf("Unit type does not exist: %s", err.UT.LogString())
|
||||
}
|
||||
|
||||
func (err ErrUnitTypeNotExist) Unwrap() error {
|
||||
|
||||
Reference in new issue
Block a user