summaryrefslogtreecommitdiff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 03:06:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 03:06:25 +0000
commit29c01c6c91558358c37ba45b03f240632bfb918d (patch)
treec6475afaf98ce740e8ba5fe227e7bd4a95b692cd /app/controllers/concerns
parenteed996ac33a60d5fd8315a62fec8beaa8e907e69 (diff)
downloadgitlab-ce-29c01c6c91558358c37ba45b03f240632bfb918d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/preview_markdown.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/app/controllers/concerns/preview_markdown.rb b/app/controllers/concerns/preview_markdown.rb
index 1d84ddfba97..c7c9f2e9b70 100644
--- a/app/controllers/concerns/preview_markdown.rb
+++ b/app/controllers/concerns/preview_markdown.rb
@@ -7,17 +7,8 @@ module PreviewMarkdown
def preview_markdown
result = PreviewMarkdownService.new(@project, current_user, markdown_service_params).execute
- markdown_params =
- case controller_name
- when 'wikis' then { pipeline: :wiki, project_wiki: @project_wiki, page_slug: params[:id] }
- when 'snippets' then { skip_project_check: true }
- when 'groups' then { group: group }
- when 'projects' then projects_filter_params
- else {}
- end
-
render json: {
- body: view_context.markdown(result[:text], markdown_params),
+ body: view_context.markdown(result[:text], markdown_context_params),
references: {
users: result[:users],
suggestions: SuggestionSerializer.new.represent_diff(result[:suggestions]),
@@ -38,5 +29,16 @@ module PreviewMarkdown
def markdown_service_params
params
end
+
+ def markdown_context_params
+ case controller_name
+ when 'wikis' then { pipeline: :wiki, project_wiki: @project_wiki, page_slug: params[:id] }
+ when 'snippets' then { skip_project_check: true }
+ when 'groups' then { group: group }
+ when 'projects' then projects_filter_params
+ else {}
+ end.merge(requested_path: params[:path])
+ end
+
# rubocop:enable Gitlab/ModuleWithInstanceVariables
end