Prevent deadlock in create issue (#17970) (#17982)

release/v1.15
zeripath 2021-12-15 02:06:40 +00:00 committed by GitHub
parent 31df892059
commit fc8c23edb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -21,13 +21,18 @@ func (repo *Repository) CanEnableTimetracker() bool {
// IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
func (repo *Repository) IsTimetrackerEnabled() bool {
return repo.isTimetrackerEnabled(x)
}
// IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
func (repo *Repository) isTimetrackerEnabled(e Engine) bool {
if !setting.Service.EnableTimetracking {
return false
}
var u *RepoUnit
var err error
if u, err = repo.GetUnit(UnitTypeIssues); err != nil {
if u, err = repo.getUnit(e, UnitTypeIssues); err != nil {
return setting.Service.DefaultEnableTimetracking
}
return u.IssuesConfig().EnableTimetracker