Commit 7cb51ba5 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix/import-issues-last-updated' into 'master'

Fix issues last update timestamp not preserved after importing a project

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19689 and https://gitlab.com/gitlab-org/gitlab-ce/issues/19792 (similar, but not the same)

Now `updated_at` should be the time from the original project.

See merge request !5253
parents 50abec8c cc6d3a83
......@@ -94,6 +94,7 @@ v 8.10.0 (unreleased)
- Redesign Builds and Pipelines pages
- Change status color and icon for running builds
- Fix markdown rendering for: consecutive labels references, label references that begin with a digit or contains `.`
- Fix last update timestamp on issues not preserved on gitlab.com and project imports
v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154
......
......@@ -15,6 +15,7 @@ module Gitlab
end
def execute
ActiveRecord::Base.no_touching do
project_identifier = CGI.escape(project.import_source)
# Issues && Comments
......@@ -39,9 +40,11 @@ module Gitlab
description: body,
title: issue["title"],
state: issue["state"],
updated_at: issue["updated_at"],
author_id: gl_user_id(project, issue["author"]["id"])
)
end
end
true
end
......
......@@ -12,7 +12,10 @@ module Gitlab
json = IO.read(@path)
@tree_hash = ActiveSupport::JSON.decode(json)
@project_members = @tree_hash.delete('project_members')
ActiveRecord::Base.no_touching do
create_relations
end
rescue => e
@shared.error(e)
false
......
......@@ -30,6 +30,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
expect(Event.where.not(data: nil).first.data[:ref]).not_to be_empty
end
it 'preserves updated_at on issues' do
restored_project_json
issue = Issue.where(description: 'Aliquam enim illo et possimus.').first
expect(issue.reload.updated_at.to_s).to eq('2016-06-14 15:02:47 UTC')
end
context 'event at forth level of the tree' do
let(:event) { Event.where(title: 'test levels').first }
......
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