Skip to content

Commit

Permalink
Prevent deadlock in create issue (go-gitea#17970) (go-gitea#17982)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeripath authored Dec 15, 2021
1 parent 31df892 commit fc8c23e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion models/repo_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc8c23e

Please sign in to comment.