Commit 4b7a3261 authored by Pavel Shutsin's avatar Pavel Shutsin

Merge branch '346495-generate-discussion-id-when-importing-github-notes' into 'master'

Generates discussion_id when importing notes from GitHub

See merge request gitlab-org/gitlab!76517
parents 37d4c011 b6a2ffad
......@@ -29,6 +29,7 @@ module Gitlab
project_id: project.id,
author_id: author_id,
note: note_body,
discussion_id: note.discussion_id,
system: false,
created_at: note.created_at,
updated_at: note.updated_at
......
......@@ -63,6 +63,14 @@ module Gitlab
@attributes = attributes
end
def discussion_id
Discussion.discussion_id(
Struct
.new(:noteable_id, :noteable_type)
.new(noteable_id, noteable_type)
)
end
alias_method :issuable_type, :noteable_type
def github_identifiers
......
......@@ -52,6 +52,7 @@ RSpec.describe Gitlab::GithubImport::Importer::NoteImporter do
project_id: project.id,
author_id: user.id,
note: 'This is my note',
discussion_id: match(/\A[0-9a-f]{40}\z/),
system: false,
created_at: created_at,
updated_at: updated_at
......@@ -82,6 +83,7 @@ RSpec.describe Gitlab::GithubImport::Importer::NoteImporter do
project_id: project.id,
author_id: project.creator_id,
note: "*Created by: alice*\n\nThis is my note",
discussion_id: match(/\A[0-9a-f]{40}\z/),
system: false,
created_at: created_at,
updated_at: updated_at
......
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