summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorkolaente <konrad@kola-entertainments.de>2018-07-17 23:23:58 +0200
committertechknowlogick <techknowlogick@users.noreply.github.com>2018-07-17 17:23:58 -0400
commit1bff02de55331e11de3627d5c5628feb2cd97387 (patch)
treed6d6ace5f246c1555b294bf096763260f7d74d7b /modules
parent7be5935c55dcdf198efdf1306bbeb2b54aa0b900 (diff)
downloadgitea-1bff02de55331e11de3627d5c5628feb2cd97387.tar.gz
gitea-1bff02de55331e11de3627d5c5628feb2cd97387.zip
Added dependencies for issues (#2196) (#2531)
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/repo_form.go1
-rw-r--r--modules/context/repo.go5
-rw-r--r--modules/setting/setting.go2
3 files changed, 8 insertions, 0 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index 4ea1ba90ec..eea5859fff 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -113,6 +113,7 @@ type RepoSettingForm struct {
PullsAllowSquash bool
EnableTimetracker bool
AllowOnlyContributorsToTrackTime bool
+ EnableIssueDependencies bool
// Admin settings
EnableHealthCheck bool
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 1fe5482ce1..7239b353ff 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -104,6 +104,11 @@ func (r *Repository) CanUseTimetracker(issue *models.Issue, user *models.User) b
r.IsWriter() || issue.IsPoster(user.ID) || isAssigned)
}
+// CanCreateIssueDependencies returns whether or not a user can create dependencies.
+func (r *Repository) CanCreateIssueDependencies(user *models.User) bool {
+ return r.Repository.IsDependenciesEnabled() && r.IsWriter()
+}
+
// GetCommitsCount returns cached commit count for current view
func (r *Repository) GetCommitsCount() (int64, error) {
var contextName string
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 410cdfbfb5..b44ba4d11b 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1180,6 +1180,7 @@ var Service struct {
DefaultAllowCreateOrganization bool
EnableTimetracking bool
DefaultEnableTimetracking bool
+ DefaultEnableDependencies bool
DefaultAllowOnlyContributorsToTrackTime bool
NoReplyAddress string
@@ -1210,6 +1211,7 @@ func newService() {
if Service.EnableTimetracking {
Service.DefaultEnableTimetracking = sec.Key("DEFAULT_ENABLE_TIMETRACKING").MustBool(true)
}
+ Service.DefaultEnableDependencies = sec.Key("DEFAULT_ENABLE_DEPENDENCIES").MustBool(true)
Service.DefaultAllowOnlyContributorsToTrackTime = sec.Key("DEFAULT_ALLOW_ONLY_CONTRIBUTORS_TO_TRACK_TIME").MustBool(true)
Service.NoReplyAddress = sec.Key("NO_REPLY_ADDRESS").MustString("noreply.example.org")