diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-08-06 16:36:31 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-08-16 11:01:02 +0300 |
commit | fb98496f49bbb324b808523ea97f0844682fe1ac (patch) | |
tree | d7729e7de783af5befdb7eea31264da934377147 /lib/gitlab/github_import | |
parent | 358675d09f6ba0fdcc4a089c6d1da6df9ff6d092 (diff) |
Trigger iid logic from GitHub importer for merge requests.
Diffstat (limited to 'lib/gitlab/github_import')
-rw-r--r-- | lib/gitlab/github_import/importer/pull_request_importer.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/github_import/importer/pull_request_importer.rb b/lib/gitlab/github_import/importer/pull_request_importer.rb index 6b3688c4381..e4b49d2143a 100644 --- a/lib/gitlab/github_import/importer/pull_request_importer.rb +++ b/lib/gitlab/github_import/importer/pull_request_importer.rb @@ -76,7 +76,13 @@ module Gitlab merge_request_id = GithubImport .insert_and_return_id(attributes, project.merge_requests) - [project.merge_requests.find(merge_request_id), false] + merge_request = project.merge_requests.find(merge_request_id) + + # We use .insert_and_return_id which effectively disables all callbacks. + # Trigger iid logic here to make sure we track internal id values consistently. + merge_request.ensure_target_project_iid! + + [merge_request, false] end rescue ActiveRecord::InvalidForeignKey # It's possible the project has been deleted since scheduling this |