Commit c29c0b30 authored by James Lopez's avatar James Lopez

Merge branch 'sh-fix-update-service' into 'master'

Fix Error 500 when updating a project

Closes #44019

See merge request gitlab-org/gitlab-ce!17647
parents ac1f3bc3 9c8e9046
...@@ -58,7 +58,7 @@ module Projects ...@@ -58,7 +58,7 @@ module Projects
def enabling_wiki? def enabling_wiki?
return false if @project.wiki_enabled? return false if @project.wiki_enabled?
params[:project_feature_attributes][:wiki_access_level].to_i > ProjectFeature::DISABLED params.dig(:project_feature_attributes, :wiki_access_level).to_i > ProjectFeature::DISABLED
end end
def ensure_wiki_exists def ensure_wiki_exists
......
...@@ -132,6 +132,15 @@ describe Projects::UpdateService do ...@@ -132,6 +132,15 @@ describe Projects::UpdateService do
expect(result).to eq({ status: :success }) expect(result).to eq({ status: :success })
expect(project.wiki_repository_exists?).to be false expect(project.wiki_repository_exists?).to be false
end end
it 'handles empty project feature attributes' do
project.project_feature.update(wiki_access_level: ProjectFeature::DISABLED)
result = update_project(project, user, { name: 'test1' })
expect(result).to eq({ status: :success })
expect(project.wiki_repository_exists?).to be false
end
end end
context 'when enabling a wiki' do context 'when enabling a wiki' do
......
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