Make clearer use of the check.

This commit is contained in:
Marin Jankovski 2013-10-17 11:36:23 +02:00
parent 78e591c737
commit 52739518bc

View file

@ -16,7 +16,7 @@ module IssuesHelper
def url_for_project_issues
return "" if @project.nil?
if @project.used_default_issues_tracker? || config_issues_tracker?
if @project.used_default_issues_tracker? || !external_issues_tracker_enabled?
project_issues_path(@project)
else
url = Gitlab.config.issues_tracker[@project.issues_tracker]["project_url"]
@ -28,7 +28,7 @@ module IssuesHelper
def url_for_new_issue
return "" if @project.nil?
if @project.used_default_issues_tracker? || config_issues_tracker?
if @project.used_default_issues_tracker? || !external_issues_tracker_enabled?
url = new_project_issue_path project_id: @project
else
url = Gitlab.config.issues_tracker[@project.issues_tracker]["new_issue_url"]
@ -40,7 +40,7 @@ module IssuesHelper
def url_for_issue(issue_iid)
return "" if @project.nil?
if @project.used_default_issues_tracker? || config_issues_tracker?
if @project.used_default_issues_tracker? || !external_issues_tracker_enabled?
url = project_issue_url project_id: @project, id: issue_iid
else
url = Gitlab.config.issues_tracker[@project.issues_tracker]["issues_url"]
@ -60,8 +60,12 @@ module IssuesHelper
end
end
def config_issues_tracker?
return false if Gitlab.config.issues_tracker && Gitlab.config.issues_tracker.values.any?
true
# Checks if issues_tracker setting exists in gitlab.yml
def external_issues_tracker_enabled?
if Gitlab.config.issues_tracker && Gitlab.config.issues_tracker.values.any?
true
else
false
end
end
end