Fork to maintain patches against the official gitea for https://code.ceondo.com https://github.com/go-gitea/gitea

repo_issue.go 1.4KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package models
  5. import "code.gitea.io/gitea/modules/setting"
  6. // ___________.__ ___________ __
  7. // \__ ___/|__| _____ ___\__ ___/___________ ____ | | __ ___________
  8. // | | | |/ \_/ __ \| | \_ __ \__ \ _/ ___\| |/ // __ \_ __ \
  9. // | | | | Y Y \ ___/| | | | \// __ \\ \___| <\ ___/| | \/
  10. // |____| |__|__|_| /\___ >____| |__| (____ /\___ >__|_ \\___ >__|
  11. // \/ \/ \/ \/ \/ \/
  12. // IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
  13. func (repo *Repository) IsTimetrackerEnabled() bool {
  14. var u *RepoUnit
  15. var err error
  16. if u, err = repo.GetUnit(UnitTypeIssues); err != nil {
  17. return setting.Service.DefaultEnableTimetracking
  18. }
  19. return u.IssuesConfig().EnableTimetracker
  20. }
  21. // AllowOnlyContributorsToTrackTime returns value of IssuesConfig or the default value
  22. func (repo *Repository) AllowOnlyContributorsToTrackTime() bool {
  23. var u *RepoUnit
  24. var err error
  25. if u, err = repo.GetUnit(UnitTypeIssues); err != nil {
  26. return setting.Service.DefaultAllowOnlyContributorsToTrackTime
  27. }
  28. return u.IssuesConfig().AllowOnlyContributorsToTrackTime
  29. }