Changes update_column to update_attributes in ProjectTreeRestorer#restore_project by using timeless to maintain the current timestamps

This commit is contained in:
Tiago Botelho 2018-08-16 11:02:34 +01:00
parent a0f2345819
commit 6dfab42236
3 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,6 @@
---
title: Importing a project no longer fails when visibility level holds a string value
type
merge_request: 21242
author:
type: fixed

View file

@ -94,7 +94,10 @@ module Gitlab
end
def restore_project
@project.update_columns(project_params)
Gitlab::Timeless.timeless(@project) do
@project.update(project_params)
end
@project
end

View file

@ -63,6 +63,16 @@ describe Gitlab::ImportExport::Importer do
importer.execute
end
it 'sets the correct visibility_level when visibility level is a string' do
project.create_or_update_import_data(
data: { override_params: { visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s } }
)
importer.execute
expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE)
end
end
context 'when project successfully restored' do