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>2015-10-07 18:00:48 +0300
committerDouwe Maan <douwe@gitlab.com>2015-10-07 18:00:48 +0300
commitf42cfa9e8757161414f88e50d23b1d618bffad1f (patch)
tree8c379580d815a37e3090213974fed6969fb2927a /app/helpers/gitlab_markdown_helper.rb
parent12626f029dc4ab345f8afa1fd42a3c04723ec55e (diff)
Refactor reference gathering to use a dedicated filter
Diffstat (limited to 'app/helpers/gitlab_markdown_helper.rb')
-rw-r--r--app/helpers/gitlab_markdown_helper.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index 6264b7f82ef..1b8bb46d25e 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -19,7 +19,8 @@ module GitlabMarkdownHelper
escape_once(body)
end
- gfm_body = Gitlab::Markdown.gfm(escaped_body, project: @project, current_user: current_user)
+ user = current_user if defined?(current_user)
+ gfm_body = Gitlab::Markdown.gfm(escaped_body, project: @project, current_user: user)
fragment = Nokogiri::HTML::DocumentFragment.parse(gfm_body)
if fragment.children.size == 1 && fragment.children[0].name == 'a'
@@ -55,8 +56,10 @@ module GitlabMarkdownHelper
ref: @ref
)
+ user = current_user if defined?(current_user)
+
html = Gitlab::Markdown.render(text, context)
- Gitlab::Markdown.post_process(html, pipeline: context[:pipeline], user: current_user)
+ Gitlab::Markdown.post_process(html, pipeline: context[:pipeline], user: user)
end
# TODO (rspeicher): Remove all usages of this helper and just call `markdown`
@@ -72,8 +75,10 @@ module GitlabMarkdownHelper
ref: @ref
)
+ user = current_user if defined?(current_user)
+
html = Gitlab::Markdown.gfm(text, options)
- Gitlab::Markdown.post_process(html, pipeline: options[:pipeline], user: current_user)
+ Gitlab::Markdown.post_process(html, pipeline: options[:pipeline], user: user)
end
def asciidoc(text)