Commit 902cec12 authored by Bob Van Landuyt's avatar Bob Van Landuyt

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 e3acc982
...@@ -1478,6 +1478,7 @@ class Project < ActiveRecord::Base ...@@ -1478,6 +1478,7 @@ class Project < ActiveRecord::Base
remove_import_jid remove_import_jid
update_project_counter_caches update_project_counter_caches
after_create_default_branch after_create_default_branch
refresh_markdown_cache!
end end
def update_project_counter_caches def update_project_counter_caches
......
...@@ -105,6 +105,7 @@ excluded_attributes: ...@@ -105,6 +105,7 @@ excluded_attributes:
- :last_repository_updated_at - :last_repository_updated_at
- :last_repository_check_at - :last_repository_check_at
- :storage_version - :storage_version
- :description_html
snippets: snippets:
- :expired_at - :expired_at
merge_request_diff: merge_request_diff:
...@@ -144,8 +145,6 @@ methods: ...@@ -144,8 +145,6 @@ methods:
- :diff_head_sha - :diff_head_sha
- :source_branch_sha - :source_branch_sha
- :target_branch_sha - :target_branch_sha
project:
- :description_html
events: events:
- :action - :action
push_event_payload: push_event_payload:
......
...@@ -83,13 +83,7 @@ module Gitlab ...@@ -83,13 +83,7 @@ module Gitlab
end end
def restore_project def restore_project
params = project_params.symbolize_keys @project.update_columns(project_params)
if params[:description].present?
params[:description_html] = nil
end
@project.update_columns(params)
@project @project
end end
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"description": "Nisi et repellendus ut enim quo accusamus vel magnam.", "description": "Nisi et repellendus ut enim quo accusamus vel magnam.",
"visibility_level": 10, "visibility_level": 10,
"archived": false, "archived": false,
"description_html": "<p dir=\"auto\">Nisi et repellendus ut enim quo accusamus vel magnam.</p>",
"labels": [ "labels": [
{ {
"id": 2, "id": 2,
......
...@@ -46,11 +46,6 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -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.') expect(Project.find_by_path('project').description).to eq('Nisi et repellendus ut enim quo accusamus vel magnam.')
end 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 it 'has the same label associated to two issues' do
expect(ProjectLabel.find_by_title('test2').issues.count).to eq(2) expect(ProjectLabel.find_by_title('test2').issues.count).to eq(2)
end end
......
...@@ -245,10 +245,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver do ...@@ -245,10 +245,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
end end
context 'project attributes' do 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 it 'does not contain the runners token' do
expect(saved_project_json).not_to include("runners_token" => 'token') expect(saved_project_json).not_to include("runners_token" => 'token')
end end
...@@ -274,7 +270,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver do ...@@ -274,7 +270,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
releases: [release], releases: [release],
group: group group: group
) )
project.update_column(:description_html, 'description')
project_label = create(:label, project: project) project_label = create(:label, project: project)
group_label = create(:group_label, group: group) group_label = create(:group_label, group: group)
create(:label_link, label: project_label, target: issue) create(:label_link, label: project_label, target: issue)
......
...@@ -3227,6 +3227,7 @@ describe Project do ...@@ -3227,6 +3227,7 @@ describe Project do
expect(project).to receive(:update_project_counter_caches) expect(project).to receive(:update_project_counter_caches)
expect(project).to receive(:remove_import_jid) expect(project).to receive(:remove_import_jid)
expect(project).to receive(:after_create_default_branch) expect(project).to receive(:after_create_default_branch)
expect(project).to receive(:refresh_markdown_cache!)
project.after_import project.after_import
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