File tree 3 files changed +11
-5
lines changed 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ func (issue *Issue) isTimetrackerEnabled(ctx context.Context) bool {
141
141
log .Error (fmt .Sprintf ("loadRepo: %v" , err ))
142
142
return false
143
143
}
144
- return issue .Repo .IsTimetrackerEnabled ( )
144
+ return issue .Repo .IsTimetrackerEnabledCtx ( ctx )
145
145
}
146
146
147
147
// GetPullRequest returns the issue pull request
Original file line number Diff line number Diff line change @@ -28,13 +28,18 @@ func (repo *Repository) CanEnableTimetracker() bool {
28
28
29
29
// IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
30
30
func (repo * Repository ) IsTimetrackerEnabled () bool {
31
+ return repo .IsTimetrackerEnabledCtx (db .DefaultContext )
32
+ }
33
+
34
+ // IsTimetrackerEnabledCtx returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
35
+ func (repo * Repository ) IsTimetrackerEnabledCtx (ctx context.Context ) bool {
31
36
if ! setting .Service .EnableTimetracking {
32
37
return false
33
38
}
34
39
35
40
var u * RepoUnit
36
41
var err error
37
- if u , err = repo .GetUnit ( unit .TypeIssues ); err != nil {
42
+ if u , err = repo .GetUnitCtx ( ctx , unit .TypeIssues ); err != nil {
38
43
return setting .Service .DefaultEnableTimetracking
39
44
}
40
45
return u .IssuesConfig ().EnableTimetracker
@@ -59,7 +64,7 @@ func (repo *Repository) IsDependenciesEnabled() bool {
59
64
func (repo * Repository ) IsDependenciesEnabledCtx (ctx context.Context ) bool {
60
65
var u * RepoUnit
61
66
var err error
62
- if u , err = repo .getUnit (ctx , unit .TypeIssues ); err != nil {
67
+ if u , err = repo .GetUnitCtx (ctx , unit .TypeIssues ); err != nil {
63
68
log .Trace ("%s" , err )
64
69
return setting .Service .DefaultEnableDependencies
65
70
}
Original file line number Diff line number Diff line change @@ -312,10 +312,11 @@ func (repo *Repository) MustGetUnit(tp unit.Type) *RepoUnit {
312
312
313
313
// GetUnit returns a RepoUnit object
314
314
func (repo * Repository ) GetUnit (tp unit.Type ) (* RepoUnit , error ) {
315
- return repo .getUnit (db .DefaultContext , tp )
315
+ return repo .GetUnitCtx (db .DefaultContext , tp )
316
316
}
317
317
318
- func (repo * Repository ) getUnit (ctx context.Context , tp unit.Type ) (* RepoUnit , error ) {
318
+ // GetUnitCtx returns a RepoUnit object
319
+ func (repo * Repository ) GetUnitCtx (ctx context.Context , tp unit.Type ) (* RepoUnit , error ) {
319
320
if err := repo .LoadUnits (ctx ); err != nil {
320
321
return nil , err
321
322
}
You can’t perform that action at this time.
0 commit comments