diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/concerns/internal_id.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/github_import/issue_formatter.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/github_import/pull_request_formatter.rb | 1 | ||||
-rw-r--r-- | spec/lib/gitlab/github_import/issue_formatter_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/github_import/pull_request_formatter_spec.rb | 3 |
6 files changed, 14 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG index 9a6f1bbfef5..2882a81afc2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -84,6 +84,7 @@ v 8.7.0 (unreleased) - Author and participants are displayed first on users autocompletion - Show number sign on external issue reference text (Florent Baldino) - Updated print style for issues + - Use GitHub Issue/PR number as iid to keep references v 8.6.6 - Expire the exists cache before deletion to ensure project dir actually exists (Stan Hu). !3413 diff --git a/app/models/concerns/internal_id.rb b/app/models/concerns/internal_id.rb index 51288094ef1..5382dde6765 100644 --- a/app/models/concerns/internal_id.rb +++ b/app/models/concerns/internal_id.rb @@ -7,11 +7,13 @@ module InternalId end def set_iid - records = project.send(self.class.name.tableize) - records = records.with_deleted if self.paranoid? - max_iid = records.maximum(:iid) + if iid.blank? + records = project.send(self.class.name.tableize) + records = records.with_deleted if self.paranoid? + max_iid = records.maximum(:iid) - self.iid = max_iid.to_i + 1 + self.iid = max_iid.to_i + 1 + end end def to_param diff --git a/lib/gitlab/github_import/issue_formatter.rb b/lib/gitlab/github_import/issue_formatter.rb index 1e3ba44f27c..acb332cb0cb 100644 --- a/lib/gitlab/github_import/issue_formatter.rb +++ b/lib/gitlab/github_import/issue_formatter.rb @@ -3,6 +3,7 @@ module Gitlab class IssueFormatter < BaseFormatter def attributes { + iid: number, project: project, title: raw_data.title, description: description, diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb index 4e507b090e8..5ee8a14624a 100644 --- a/lib/gitlab/github_import/pull_request_formatter.rb +++ b/lib/gitlab/github_import/pull_request_formatter.rb @@ -3,6 +3,7 @@ module Gitlab class PullRequestFormatter < BaseFormatter def attributes { + iid: number, title: raw_data.title, description: description, source_project: source_project, diff --git a/spec/lib/gitlab/github_import/issue_formatter_spec.rb b/spec/lib/gitlab/github_import/issue_formatter_spec.rb index fd05428b322..4f3d7f4405b 100644 --- a/spec/lib/gitlab/github_import/issue_formatter_spec.rb +++ b/spec/lib/gitlab/github_import/issue_formatter_spec.rb @@ -30,6 +30,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do it 'returns formatted attributes' do expected = { + iid: 1347, project: project, title: 'Found a bug', description: "*Created by: octocat*\n\nI'm having a problem with this.", @@ -50,6 +51,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do it 'returns formatted attributes' do expected = { + iid: 1347, project: project, title: 'Found a bug', description: "*Created by: octocat*\n\nI'm having a problem with this.", diff --git a/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb b/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb index e49dcb42342..11249e57ca8 100644 --- a/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb +++ b/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb @@ -35,6 +35,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do it 'returns formatted attributes' do expected = { + iid: 1347, title: 'New feature', description: "*Created by: octocat*\n\nPlease pull these awesome changes", source_project: project, @@ -58,6 +59,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do it 'returns formatted attributes' do expected = { + iid: 1347, title: 'New feature', description: "*Created by: octocat*\n\nPlease pull these awesome changes", source_project: project, @@ -81,6 +83,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do it 'returns formatted attributes' do expected = { + iid: 1347, title: 'New feature', description: "*Created by: octocat*\n\nPlease pull these awesome changes", source_project: project, |