Commit 80d12040 authored by Alex Pooley's avatar Alex Pooley

Merge branch 'jh-247-add-controller-prepend-mod' into 'master'

Add controller prepend mod for JH content validation service

See merge request gitlab-org/gitlab!74159
parents 729cfb2c 8de0b794
......@@ -51,3 +51,5 @@ module Snippets::BlobsActions
params[:snippet_id]
end
end
Snippets::BlobsActions.prepend_mod
......@@ -83,7 +83,8 @@ module WikiActions
render 'shared/wikis/show'
elsif file_blob
send_blob(wiki.repository, file_blob)
# This is needed by [GitLab JH](https://gitlab.com/gitlab-jh/gitlab/-/issues/247)
send_wiki_file_blob(wiki, file_blob)
elsif show_create_form?
# Assign a title to the WikiPage unless `id` is a randomly generated slug from #new
title = params[:id] unless params[:random_title].present?
......@@ -305,4 +306,10 @@ module WikiActions
view: diff_view
}
end
def send_wiki_file_blob(wiki, file_blob)
send_blob(wiki.repository, file_blob)
end
end
WikiActions.prepend_mod
......@@ -27,3 +27,5 @@ class Projects::BlameController < Projects::ApplicationController
@blame = Gitlab::View::Presenter::Factory.new(@blame, project: @project, path: @path).fabricate!
end
end
Projects::BlameController.prepend_mod
......@@ -298,3 +298,5 @@ class Projects::BlobController < Projects::ApplicationController
experiment(:code_quality_walkthrough, namespace: @project.root_ancestor).track(:commit_created)
end
end
Projects::BlobController.prepend_mod
......@@ -36,6 +36,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
options = {
environment: environment,
merge_request: @merge_request,
commit: commit,
diff_view: diff_view,
merge_ref_head_diff: render_merge_ref_head_diff?,
pagination_data: diffs.pagination_data,
......
......@@ -51,3 +51,5 @@ class Projects::RawController < Projects::ApplicationController
.raw_blob_request_limit
end
end
Projects::RawController.prepend_mod
......@@ -35,3 +35,5 @@ module Resolvers
end
end
end
Resolvers::Snippets::BlobsResolver.prepend_mod
......@@ -57,3 +57,5 @@ class SnippetBlobPresenter < BlobPresenter
gitlab_raw_snippet_blob_url(snippet, blob.path, only_path: only_path)
end
end
SnippetBlobPresenter.prepend_mod
......@@ -90,3 +90,5 @@ class DiffFileEntity < DiffFileBaseEntity
options.fetch(:diff_view, :inline).to_sym
end
end
DiffFileEntity.prepend_mod
......@@ -496,6 +496,7 @@ RSpec.describe Projects::MergeRequests::DiffsController do
{
environment: nil,
merge_request: merge_request,
commit: nil,
diff_view: :inline,
merge_ref_head_diff: nil,
allow_tree_conflicts: true,
......@@ -552,7 +553,7 @@ RSpec.describe Projects::MergeRequests::DiffsController do
it_behaves_like 'serializes diffs with expected arguments' do
let(:collection) { Gitlab::Diff::FileCollection::Commit }
let(:expected_options) { collection_arguments }
let(:expected_options) { collection_arguments.merge(commit: merge_request.commits(limit: 1).first) }
end
end
......
......@@ -31,6 +31,7 @@ RSpec.describe 'Merge Requests Diffs' do
{
environment: nil,
merge_request: merge_request,
commit: nil,
diff_view: :inline,
merge_ref_head_diff: nil,
allow_tree_conflicts: true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment