diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-08 13:04:59 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-08 13:22:20 +0100 |
commit | af6b5437421106caf34719e37d359808b88eb45c (patch) | |
tree | c3d9191c3ea32c947fe13b38bb1fd9423fb23d23 /lib | |
parent | c767d0e6bd95e73217a92040d568b34e14b65949 (diff) | |
download | gitlab-ce-af6b5437421106caf34719e37d359808b88eb45c.tar.gz |
Make commit and MR ref filters aware of /builds path
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/markdown/commit_reference_filter.rb | 11 | ||||
-rw-r--r-- | lib/gitlab/markdown/merge_request_reference_filter.rb | 8 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/gitlab/markdown/commit_reference_filter.rb b/lib/gitlab/markdown/commit_reference_filter.rb index b4036578e60..e3066a89b04 100644 --- a/lib/gitlab/markdown/commit_reference_filter.rb +++ b/lib/gitlab/markdown/commit_reference_filter.rb @@ -47,6 +47,17 @@ module Gitlab def object_link_title(commit) commit.link_title end + + def object_link_text_extras(object, matches) + extras = super + + path = matches[:path] if matches.names.include?("path") + if path == '/builds' + extras.unshift "builds" + end + + extras + end end end end diff --git a/lib/gitlab/markdown/merge_request_reference_filter.rb b/lib/gitlab/markdown/merge_request_reference_filter.rb index de71fc76a9b..79d67870b14 100644 --- a/lib/gitlab/markdown/merge_request_reference_filter.rb +++ b/lib/gitlab/markdown/merge_request_reference_filter.rb @@ -24,8 +24,14 @@ module Gitlab def object_link_text_extras(object, matches) extras = super - if matches.names.include?("path") && matches[:path] && matches[:path] == '/diffs' + path = matches[:path] if matches.names.include?("path") + case path + when '/diffs' extras.unshift "diffs" + when '/builds' + extras.unshift "builds" + when '/commits' + extras.unshift "commits" end extras |