diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 03:06:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 03:06:25 +0000 |
commit | 29c01c6c91558358c37ba45b03f240632bfb918d (patch) | |
tree | c6475afaf98ce740e8ba5fe227e7bd4a95b692cd /app/controllers/concerns | |
parent | eed996ac33a60d5fd8315a62fec8beaa8e907e69 (diff) | |
download | gitlab-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.rb | 22 |
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 |