Commit c99f42ce authored by Max Wippert's avatar Max Wippert

fixed redmine<->gitlab integration

- when a proect configures "Lightweight issue tracking system for this project"
  to be "Issues tracker" = "Redmine", Wiki-Markdown text like "lorem ipsum #123"
  should be rendered to a hyperlink to Redmine
- without this patch/enhancment this did not work
- internal bugtracker id = redmine 16693
parent 005c421f
...@@ -338,6 +338,10 @@ class Project < ActiveRecord::Base ...@@ -338,6 +338,10 @@ class Project < ActiveRecord::Base
self.issues_tracker == "jira" self.issues_tracker == "jira"
end end
def redmine_tracker?
self.issues_tracker == "redmine"
end
# For compatibility with old code # For compatibility with old code
def code def code
path path
......
...@@ -192,8 +192,10 @@ module Gitlab ...@@ -192,8 +192,10 @@ module Gitlab
link_to("##{identifier}", url, options) link_to("##{identifier}", url, options)
end end
else elsif project.redmine_tracker?
reference_jira_issue(identifier, project) if project.jira_tracker? reference_redmine_issue(identifier, project)
elsif project.jira_tracker?
reference_jira_issue(identifier, project)
end end
end end
...@@ -239,5 +241,16 @@ module Gitlab ...@@ -239,5 +241,16 @@ module Gitlab
) )
link_to("#{identifier}", url, options) link_to("#{identifier}", url, options)
end end
def reference_redmine_issue(identifier, project = @project)
url = url_for_issue(identifier)
title = Gitlab.config.issues_tracker[project.issues_tracker]["title"]
options = html_options.merge(
title: "Issue in #{title}",
class: "gfm gfm-issue #{html_options[:class]}"
)
link_to("rm##{identifier}", url, options)
end
end end
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