summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-23 12:58:55 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-23 12:58:55 -0400
commita14d109b9b487a379b82c578b42012f690e3c469 (patch)
treeea39f0c8440382cf35b3aa7410c33191ad393c1f /lib
parentb71e5a17e9f03ce6387310cfdcc6eb94f8d021df (diff)
downloadgitlab-ce-a14d109b9b487a379b82c578b42012f690e3c469.tar.gz
Provide autoload paths for filters to prevent circular dependency
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/markdown.rb17
-rw-r--r--lib/gitlab/markdown/cross_project_reference.rb2
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 37b250d353e..44779d7fdd8 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -29,6 +29,17 @@ module Gitlab
# >> gfm(":trollface:")
# => "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
module Markdown
+ # Provide autoload paths for filters to prevent a circular dependency error
+ autoload :CommitRangeReferenceFilter, 'gitlab/markdown/commit_range_reference_filter'
+ autoload :CommitReferenceFilter, 'gitlab/markdown/commit_reference_filter'
+ autoload :EmojiFilter, 'gitlab/markdown/emoji_filter'
+ autoload :ExternalIssueReferenceFilter, 'gitlab/markdown/external_issue_reference_filter'
+ autoload :IssueReferenceFilter, 'gitlab/markdown/issue_reference_filter'
+ autoload :LabelReferenceFilter, 'gitlab/markdown/label_reference_filter'
+ autoload :MergeRequestReferenceFilter, 'gitlab/markdown/merge_request_reference_filter'
+ autoload :SnippetReferenceFilter, 'gitlab/markdown/snippet_reference_filter'
+ autoload :UserReferenceFilter, 'gitlab/markdown/user_reference_filter'
+
# Public: Parse the provided text with GitLab-Flavored Markdown
#
# text - the source text
@@ -64,11 +75,11 @@ module Gitlab
context = {
# SanitizationFilter
- whitelist: sanitization_whitelist,
+ whitelist: sanitization_whitelist,
# EmojiFilter
- asset_root: Gitlab.config.gitlab.url,
- asset_host: Gitlab::Application.config.asset_host,
+ asset_root: Gitlab.config.gitlab.url,
+ asset_host: Gitlab::Application.config.asset_host,
# ReferenceFilter
current_user: current_user,
diff --git a/lib/gitlab/markdown/cross_project_reference.rb b/lib/gitlab/markdown/cross_project_reference.rb
index 887c205cdc9..c436fabd658 100644
--- a/lib/gitlab/markdown/cross_project_reference.rb
+++ b/lib/gitlab/markdown/cross_project_reference.rb
@@ -20,7 +20,7 @@ module Gitlab
other = Project.find_with_namespace(ref)
return nil unless other && user_can_reference_project?(other)
-
+
other
end