diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-30 17:27:33 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-04-30 17:27:33 -0400 |
commit | 84a7675ea69b8bbd3e95a94fbcfad716daa77b36 (patch) | |
tree | 36b4bd7fdbabd9f27733669414ffc06f6dd1402b | |
parent | 242bebc13483c281af8bd2e0e9f6d7346997481e (diff) | |
download | gitlab-ce-84a7675ea69b8bbd3e95a94fbcfad716daa77b36.tar.gz |
Remove title_for_issue helper
-rw-r--r-- | app/helpers/issues_helper.rb | 13 | ||||
-rw-r--r-- | app/models/external_issue.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/markdown/issue_reference_filter.rb | 6 | ||||
-rw-r--r-- | spec/helpers/issues_helper_spec.rb | 18 |
4 files changed, 6 insertions, 35 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index c3b4731dff3..36d3f371c1b 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -43,17 +43,6 @@ module IssuesHelper end end - def title_for_issue(issue_iid, project = @project) - return '' if project.nil? - - if project.default_issues_tracker? - issue = project.issues.where(iid: issue_iid).first - return issue.title if issue - end - - '' - end - def issue_timestamp(issue) # Shows the created at time and the updated at time if different ts = "#{time_ago_with_tooltip(issue.created_at, 'bottom', 'note_created_ago')}" @@ -110,5 +99,5 @@ module IssuesHelper end # Required for Gitlab::Markdown::IssueReferenceFilter - module_function :url_for_issue, :title_for_issue + module_function :url_for_issue end diff --git a/app/models/external_issue.rb b/app/models/external_issue.rb index 50efcb32f1b..85fdb12bfdc 100644 --- a/app/models/external_issue.rb +++ b/app/models/external_issue.rb @@ -15,6 +15,10 @@ class ExternalIssue @issue_identifier.to_s end + def title + "External Issue #{self}" + end + def ==(other) other.is_a?(self.class) && (to_s == other.to_s) end diff --git a/lib/gitlab/markdown/issue_reference_filter.rb b/lib/gitlab/markdown/issue_reference_filter.rb index 6812b933fef..1e885615163 100644 --- a/lib/gitlab/markdown/issue_reference_filter.rb +++ b/lib/gitlab/markdown/issue_reference_filter.rb @@ -52,7 +52,7 @@ module Gitlab url = url_for_issue(id, project, only_path: context[:only_path]) - title = escape_once("Issue: #{title_for_issue(id, project)}") + title = escape_once("Issue: #{issue.title}") klass = reference_class(:issue) %(<a href="#{url}" @@ -67,10 +67,6 @@ module Gitlab def url_for_issue(*args) IssuesHelper.url_for_issue(*args) end - - def title_for_issue(*args) - IssuesHelper.title_for_issue(*args) - end end end end diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index 54dd8d4aa64..c08ddb4cae1 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -5,24 +5,6 @@ describe IssuesHelper do let(:issue) { create :issue, project: project } let(:ext_project) { create :redmine_project } - describe "title_for_issue" do - it "should return issue title if used internal tracker" do - @project = project - expect(title_for_issue(issue.iid)).to eq issue.title - end - - it "should always return empty string if used external tracker" do - @project = ext_project - expect(title_for_issue(rand(100))).to eq "" - end - - it "should always return empty string if project nil" do - @project = nil - - expect(title_for_issue(rand(100))).to eq "" - end - end - describe "url_for_project_issues" do let(:project_url) { ext_project.external_issue_tracker.project_url } let(:ext_expected) do |