mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Rename almost all Ctx functions (#22071)
This commit is contained in:
@@ -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