Read about our upcoming Code of Conduct on this issue

Commit ed0176f4 authored by Bob Van Landuyt's avatar Bob Van Landuyt
Browse files

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
parent 43626329a768
......@@ -1478,6 +1478,7 @@ def after_import
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 @@ def default_relation_list
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 @@
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 @@
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 @@ def setup_project
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 @@ def domain_variable
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
......
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