aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authoryp053272023-02-19 17:31:39 +0900
committerGitHub2023-02-19 16:31:39 +0800
commit7eaf192967b7eec9598e296f2919c96e4e88d324 (patch)
treee1a574498eb290bf5766f86f25da85adaa5286a2 /models
parent61b89747ed54e17ab5c7730adbad1c5d4d5ff78a (diff)
Rename `GetUnits` to `LoadUnits` (#22970)
Same as https://github.com/go-gitea/gitea/pull/22967 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models')
-rw-r--r--models/organization/team.go10
-rw-r--r--models/organization/team_list.go2
2 files changed, 4 insertions, 8 deletions
diff --git a/models/organization/team.go b/models/organization/team.go
index 0c2577dab..5e3c9ecff 100644
--- a/models/organization/team.go
+++ b/models/organization/team.go
@@ -111,12 +111,8 @@ func (t *Team) ColorFormat(s fmt.State) {
t.AccessMode)
}
-// GetUnits return a list of available units for a team
-func (t *Team) GetUnits() error {
- return t.getUnits(db.DefaultContext)
-}
-
-func (t *Team) getUnits(ctx context.Context) (err error) {
+// LoadUnits load a list of available units for a team
+func (t *Team) LoadUnits(ctx context.Context) (err error) {
if t.Units != nil {
return nil
}
@@ -193,7 +189,7 @@ func (t *Team) UnitEnabled(ctx context.Context, tp unit.Type) bool {
// UnitAccessMode returns if the team has the given unit type enabled
func (t *Team) UnitAccessMode(ctx context.Context, tp unit.Type) perm.AccessMode {
- if err := t.getUnits(ctx); err != nil {
+ if err := t.LoadUnits(ctx); err != nil {
log.Warn("Error loading team (ID: %d) units: %s", t.ID, err.Error())
}
diff --git a/models/organization/team_list.go b/models/organization/team_list.go
index 5d3bd555c..efb3104ad 100644
--- a/models/organization/team_list.go
+++ b/models/organization/team_list.go
@@ -19,7 +19,7 @@ type TeamList []*Team
func (t TeamList) LoadUnits(ctx context.Context) error {
for _, team := range t {
- if err := team.getUnits(ctx); err != nil {
+ if err := team.LoadUnits(ctx); err != nil {
return err
}
}