1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-24 17:44:27 +00:00

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

This commit is contained in:
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

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