Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-01-05 18:40:23 +0300
committerDouwe Maan <douwe@gitlab.com>2016-01-05 18:40:23 +0300
commitfd91b48f24d9f9d5e8f357b7b5324d279ce41077 (patch)
treecfa6e79e3bdbfde4b67b7bc549b6c3548a66bdaf /lib/gitlab/reference_extractor.rb
parent7dedd997b910f65ee3c494d906fbc2392962c114 (diff)
parent7c3c901ada6fc4a6d2d3ce7a2cf8188cf6615008 (diff)
Merge branch 'master' into milestone-ref
Diffstat (limited to 'lib/gitlab/reference_extractor.rb')
-rw-r--r--lib/gitlab/reference_extractor.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb
index c87068051ab..4164e998dd1 100644
--- a/lib/gitlab/reference_extractor.rb
+++ b/lib/gitlab/reference_extractor.rb
@@ -3,11 +3,12 @@ require 'banzai'
module Gitlab
# Extract possible GFM references from an arbitrary String for further processing.
class ReferenceExtractor < Banzai::ReferenceExtractor
- attr_accessor :project, :current_user
+ attr_accessor :project, :current_user, :author
- def initialize(project, current_user = nil)
+ def initialize(project, current_user = nil, author = nil)
@project = project
@current_user = current_user
+ @author = author
@references = {}
@@ -20,18 +21,22 @@ module Gitlab
%i(user label milestone merge_request snippet commit commit_range).each do |type|
define_method("#{type}s") do
- @references[type] ||= references(type, project: project, current_user: current_user)
+ @references[type] ||= references(type, reference_context)
end
end
def issues
- options = { project: project, current_user: current_user }
-
if project && project.jira_tracker?
- @references[:external_issue] ||= references(:external_issue, options)
+ @references[:external_issue] ||= references(:external_issue, reference_context)
else
- @references[:issue] ||= references(:issue, options)
+ @references[:issue] ||= references(:issue, reference_context)
end
end
+
+ private
+
+ def reference_context
+ { project: project, current_user: current_user, author: author }
+ end
end
end