summaryrefslogtreecommitdiffstats
path: root/models/repo_issue.go
diff options
context:
space:
mode:
authorBwko <bouwko@gmail.com>2018-04-09 17:15:32 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2018-04-09 23:15:32 +0800
commit8ee45eb614eaa4814936a2166addc8c1208ea1f5 (patch)
treeaa63463560f676b1be03ac53f817b32e52d5e334 /models/repo_issue.go
parent30c81a126c36da555f3e982d36c38779d962edfd (diff)
downloadgitea-8ee45eb614eaa4814936a2166addc8c1208ea1f5.tar.gz
gitea-8ee45eb614eaa4814936a2166addc8c1208ea1f5.zip
Add EnableTimetracking option to app settings (#3719)
Diffstat (limited to 'models/repo_issue.go')
-rw-r--r--models/repo_issue.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/repo_issue.go b/models/repo_issue.go
index 10356d2c98..433d0e39bd 100644
--- a/models/repo_issue.go
+++ b/models/repo_issue.go
@@ -13,8 +13,18 @@ import "code.gitea.io/gitea/modules/setting"
// |____| |__|__|_| /\___ >____| |__| (____ /\___ >__|_ \\___ >__|
// \/ \/ \/ \/ \/ \/
+// CanEnableTimetracker returns true when the server admin enabled time tracking
+// This overrules IsTimetrackerEnabled
+func (repo *Repository) CanEnableTimetracker() bool {
+ return setting.Service.EnableTimetracking
+}
+
// 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 {
+ if !setting.Service.EnableTimetracking {
+ return false
+ }
+
var u *RepoUnit
var err error
if u, err = repo.GetUnit(UnitTypeIssues); err != nil {