mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-10 02:31:39 +02:00
Rename almost all Ctx functions (#22071)
This commit is contained in:
1 parent
097d4e30b1
commit
68704532c2
78 files changed
+562
-611
No files matched your search
@@ -242,18 +242,12 @@ func (t *Team) LoadMembers(ctx context.Context) (err error) {
|
||||
}
|
||||
|
||||
// UnitEnabled returns if the team has the given unit type enabled
|
||||
func (t *Team) UnitEnabled(tp unit.Type) bool {
|
||||
return t.UnitAccessMode(tp) > perm.AccessModeNone
|
||||
func (t *Team) UnitEnabled(ctx context.Context, tp unit.Type) bool {
|
||||
return t.UnitAccessMode(ctx, tp) > perm.AccessModeNone
|
||||
}
|
||||
|
||||
// UnitAccessMode returns if the team has the given unit type enabled
|
||||
// it is called in templates, should not be replaced by `UnitAccessModeCtx(ctx ...)`
|
||||
func (t *Team) UnitAccessMode(tp unit.Type) perm.AccessMode { // Notice: It will be used in template, don't remove it directly
|
||||
return t.UnitAccessModeCtx(db.DefaultContext, tp)
|
||||
}
|
||||
|
||||
// UnitAccessModeCtx returns if the team has the given unit type enabled
|
||||
func (t *Team) UnitAccessModeCtx(ctx context.Context, tp unit.Type) perm.AccessMode {
|
||||
func (t *Team) UnitAccessMode(ctx context.Context, tp unit.Type) perm.AccessMode {
|
||||
if err := t.getUnits(ctx); err != nil {
|
||||
log.Warn("Error loading team (ID: %d) units: %s", t.ID, err.Error())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user