Don't export `Project#description_html`
Since we can regenerate `description_html` from the `description`, we should not export it. This avoids some complexity when overriding the description during an import/export where we would need to invalidate this cached field. Now we refresh the markdown cache after the import
This commit is contained in:
parent
e3acc982a8
commit
902cec12b5
|
@ -1478,6 +1478,7 @@ class Project < ActiveRecord::Base
|
|||
remove_import_jid
|
||||
update_project_counter_caches
|
||||
after_create_default_branch
|
||||
refresh_markdown_cache!
|
||||
end
|
||||
|
||||
def update_project_counter_caches
|
||||
|
|
|
@ -105,6 +105,7 @@ excluded_attributes:
|
|||
- :last_repository_updated_at
|
||||
- :last_repository_check_at
|
||||
- :storage_version
|
||||
- :description_html
|
||||
snippets:
|
||||
- :expired_at
|
||||
merge_request_diff:
|
||||
|
@ -144,8 +145,6 @@ methods:
|
|||
- :diff_head_sha
|
||||
- :source_branch_sha
|
||||
- :target_branch_sha
|
||||
project:
|
||||
- :description_html
|
||||
events:
|
||||
- :action
|
||||
push_event_payload:
|
||||
|
|
|
@ -83,13 +83,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def restore_project
|
||||
params = project_params.symbolize_keys
|
||||
|
||||
if params[:description].present?
|
||||
params[:description_html] = nil
|
||||
end
|
||||
|
||||
@project.update_columns(params)
|
||||
@project.update_columns(project_params)
|
||||
@project
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
"description": "Nisi et repellendus ut enim quo accusamus vel magnam.",
|
||||
"visibility_level": 10,
|
||||
"archived": false,
|
||||
"description_html": "<p dir=\"auto\">Nisi et repellendus ut enim quo accusamus vel magnam.</p>",
|
||||
"labels": [
|
||||
{
|
||||
"id": 2,
|
||||
|
|
|
@ -46,11 +46,6 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
|
|||
expect(Project.find_by_path('project').description).to eq('Nisi et repellendus ut enim quo accusamus vel magnam.')
|
||||
end
|
||||
|
||||
it 'has the project html description' do
|
||||
expected_description_html = "<p dir=\"auto\">Nisi et repellendus ut enim quo accusamus vel magnam.</p>"
|
||||
expect(Project.find_by_path('project').description_html).to eq(expected_description_html)
|
||||
end
|
||||
|
||||
it 'has the same label associated to two issues' do
|
||||
expect(ProjectLabel.find_by_title('test2').issues.count).to eq(2)
|
||||
end
|
||||
|
|
|
@ -245,10 +245,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
|
|||
end
|
||||
|
||||
context 'project attributes' do
|
||||
it 'contains the html description' do
|
||||
expect(saved_project_json).to include("description_html" => 'description')
|
||||
end
|
||||
|
||||
it 'does not contain the runners token' do
|
||||
expect(saved_project_json).not_to include("runners_token" => 'token')
|
||||
end
|
||||
|
@ -274,7 +270,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
|
|||
releases: [release],
|
||||
group: group
|
||||
)
|
||||
project.update_column(:description_html, 'description')
|
||||
project_label = create(:label, project: project)
|
||||
group_label = create(:group_label, group: group)
|
||||
create(:label_link, label: project_label, target: issue)
|
||||
|
|
|
@ -3227,6 +3227,7 @@ describe Project do
|
|||
expect(project).to receive(:update_project_counter_caches)
|
||||
expect(project).to receive(:remove_import_jid)
|
||||
expect(project).to receive(:after_create_default_branch)
|
||||
expect(project).to receive(:refresh_markdown_cache!)
|
||||
|
||||
project.after_import
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue