diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-05-06 19:51:56 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-13 15:33:38 +0300 |
commit | 6b04a5f9108c640f638afa8055e2a5b60f926d5a (patch) | |
tree | a0d58992330c6c18a933cec75ea8d0c50620eb7c /lib | |
parent | 1f1c59b61d30b76d69f0f925b43a0b96465f38ed (diff) | |
download | gitlab-ce-6b04a5f9108c640f638afa8055e2a5b60f926d5a.tar.gz |
Add support for Jira ticket mentions in format JIRA-123.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
CHANGELOG-EE
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/markdown.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index de14a3eca27..dca3d7a7bed 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -98,6 +98,7 @@ module Gitlab (?<prefix>\W)? # Prefix ( # Reference @(?<user>[a-zA-Z][a-zA-Z0-9_\-\.]*) # User name + |(?<issue>([A-Z\-]+-)\d+) # JIRA Issue ID |\#(?<issue>([a-zA-Z\-]+-)?\d+) # Issue ID |!(?<merge_request>\d+) # MR ID |\$(?<snippet>\d+) # Snippet ID @@ -172,11 +173,15 @@ module Gitlab end def reference_issue(identifier) - if @project.issue_exists? identifier - url = url_for_issue(identifier) - title = title_for_issue(identifier) + if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? + if @project.issue_exists? identifier + url = url_for_issue(identifier) + title = title_for_issue(identifier) - link_to("##{identifier}", url, html_options.merge(title: "Issue: #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + link_to("##{identifier}", url, html_options.merge(title: "Issue: #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + end + else + reference_jira_issue(identifier) if @project.issues_tracker == "jira" end end @@ -197,5 +202,12 @@ module Gitlab link_to(identifier, project_commit_url(@project, commit), html_options.merge(title: commit.link_title, class: "gfm gfm-commit #{html_options[:class]}")) end end + + def reference_jira_issue(identifier) + url = url_for_issue(identifier) + title = Gitlab.config.issues_tracker[@project.issues_tracker]["title"] + + link_to("#{identifier}", url, html_options.merge(title: "Issue in #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + end end end |