Prevent loading wiki content for destroy and diff actions

In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81513 we
add a param to avoid loading the wiki page content. In
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71753 we
avoid loading the content for the show and history actions.

But there are other actions where we don't need the wiki page
content and we still load it. These actions are `diff`
and `destroy`.

Changelog: performance
parent 2667a582
......@@ -312,7 +312,7 @@ module WikiActions
end
def load_content?
return false if params[:action] == 'history'
return false if %w[history destroy diff].include?(params[:action])
return false if params[:action] == 'show' && Feature.enabled?(:wiki_async_load, container, default_enabled: :yaml)
true
......
......@@ -150,6 +150,7 @@ RSpec.shared_examples 'wiki controller actions' do
expect(response).to render_template('shared/wikis/diff')
expect(assigns(:diffs)).to be_a(Gitlab::Diff::FileCollection::Base)
expect(assigns(:diff_notes_disabled)).to be(true)
expect(assigns(:page).content).to be_empty
end
end
......@@ -475,9 +476,13 @@ RSpec.shared_examples 'wiki controller actions' do
context 'when page exists' do
shared_examples 'deletes the page' do
specify do
expect do
request
end.to change { wiki.list_pages.size }.by(-1)
aggregate_failures do
expect do
request
end.to change { wiki.list_pages.size }.by(-1)
expect(assigns(:page).content).to be_empty
end
end
end
......
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