Commit d13bba44 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Use GitHub Issue/PR number as iid to keep references

With these changes we don’t lost the issue/pr references when importing
them to GitLab.
parent e90001c1e238
......@@ -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
......
......@@ -3,6 +3,7 @@ module GithubImport
class IssueFormatter < BaseFormatter
def attributes
{
iid: number,
project: project,
title: raw_data.title,
description: description,
......
......@@ -3,6 +3,7 @@ module GithubImport
class PullRequestFormatter < BaseFormatter
def attributes
{
iid: number,
title: raw_data.title,
description: description,
source_project: source_project,
......
......@@ -30,6 +30,7 @@
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 @@
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.",
......
......@@ -35,6 +35,7 @@
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 @@
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 @@
it 'returns formatted attributes' do
expected = {
iid: 1347,
title: 'New feature',
description: "*Created by: octocat*\n\nPlease pull these awesome changes",
source_project: project,
......
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