This instance will be upgraded to Heptapod 0.27.1 on 2021-12-08 at 22:00 UTC+1 (a few minutes of down time)

Commit 7c701acf authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Do a check which issue tracker is used inside the project.

parent b7a721d4ed0c
......@@ -16,7 +16,7 @@ def unassigned_filter
def url_for_project_issues(project = @project)
return '' if project.nil?
if project.used_default_issues_tracker? || !project.external_issues_tracker_enabled?
if project.using_issue_tracker?
project_issues_path(project)
else
url = Gitlab.config.issues_tracker[project.issues_tracker]['project_url']
......@@ -28,7 +28,7 @@ def url_for_project_issues(project = @project)
def url_for_new_issue(project = @project)
return '' if project.nil?
if project.used_default_issues_tracker? || !project.external_issues_tracker_enabled?
if project.using_issue_tracker?
url = new_project_issue_path project_id: project
else
issues_tracker = Gitlab.config.issues_tracker[project.issues_tracker]
......@@ -41,7 +41,7 @@ def url_for_new_issue(project = @project)
def url_for_issue(issue_iid, project = @project)
return '' if project.nil?
if project.used_default_issues_tracker? || !project.external_issues_tracker_enabled?
if project.using_issue_tracker?
url = project_issue_url project_id: project, id: issue_iid
else
url = Gitlab.config.issues_tracker[project.issues_tracker]['issues_url']
......@@ -54,7 +54,7 @@ def url_for_issue(issue_iid, project = @project)
def title_for_issue(issue_iid, project = @project)
return '' if project.nil?
if project.used_default_issues_tracker?
if project.default_issues_tracker?
issue = project.issues.where(iid: issue_iid).first
return issue.title if issue
end
......
......@@ -298,14 +298,14 @@ def project_id
end
def issue_exists?(issue_id)
if used_default_issues_tracker?
if default_issues_tracker?
self.issues.where(iid: issue_id).first.present?
else
true
end
end
def used_default_issues_tracker?
def default_issues_tracker?
self.issues_tracker == Project.issues_tracker.default_value
end
......@@ -321,8 +321,12 @@ def external_issue_tracker
@external_issues_tracker ||= external_issues_trackers.select(&:activated?).first
end
def using_issue_tracker?
default_issues_tracker? || !external_issues_tracker_enabled?
end
def can_have_issues_tracker_id?
self.issues_enabled && !self.used_default_issues_tracker?
self.issues_enabled && !self.default_issues_tracker?
end
def build_missing_services
......
......@@ -39,7 +39,7 @@
%i.fa.fa-exclamation-circle
%span
Issues
- if @project.used_default_issues_tracker?
- if @project.default_issues_tracker?
%span.count.issue_counter= @project.issues.opened.count
- if project_nav_tab? :merge_requests
......
......@@ -208,7 +208,7 @@ def reference_user(identifier, project = @project, _ = nil)
end
def reference_issue(identifier, project = @project, prefix_text = nil)
if project.used_default_issues_tracker? || !project.external_issues_tracker_enabled?
if project.using_issue_tracker?
if project.issue_exists? identifier
url = url_for_issue(identifier, project)
title = title_for_issue(identifier, project)
......
......@@ -195,16 +195,16 @@
end
end
describe :used_default_issues_tracker? do
describe :default_issues_tracker? do
let(:project) { create(:project) }
let(:ext_project) { create(:redmine_project) }
it "should be true if used internal tracker" do
project.used_default_issues_tracker?.should be_true
project.default_issues_tracker?.should be_true
end
it "should be false if used other tracker" do
ext_project.used_default_issues_tracker?.should be_false
ext_project.default_issues_tracker?.should be_false
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment