summaryrefslogtreecommitdiff
path: root/lib/gitlab/bitbucket_server_import
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-08-02 15:52:11 -0700
committerStan Hu <stanhu@gmail.com>2018-08-02 15:52:11 -0700
commit61f5c2e38c9699f9ce9307997b2b0f4ca44205f6 (patch)
tree5573947e99abff196b7da4c586dd56b50f84a98d /lib/gitlab/bitbucket_server_import
parentf2a99398bfd66a1971c2d26461fec508106e6eb9 (diff)
downloadgitlab-ce-61f5c2e38c9699f9ce9307997b2b0f4ca44205f6.tar.gz
Add a comment when user can't be identified
Diffstat (limited to 'lib/gitlab/bitbucket_server_import')
-rw-r--r--lib/gitlab/bitbucket_server_import/importer.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/bitbucket_server_import/importer.rb b/lib/gitlab/bitbucket_server_import/importer.rb
index eb3b76409cd..c67797501c6 100644
--- a/lib/gitlab/bitbucket_server_import/importer.rb
+++ b/lib/gitlab/bitbucket_server_import/importer.rb
@@ -298,7 +298,15 @@ module Gitlab
end
def pull_request_comment_attributes(comment)
- note =
+ author = find_user_id(comment.author_email)
+ note = ''
+
+ unless author
+ author = project.creator_id
+ note = "*By #{comment.author_username} (#{comment.author_email}) on #{comment.created_at}*\n\n"
+ end
+
+ note +=
# Provide some context for replying
if comment.parent_comment
"> #{comment.parent_comment.note.truncate(80)}\n\n#{comment.note}"
@@ -309,7 +317,7 @@ module Gitlab
{
project: project,
note: note,
- author_id: gitlab_user_id(comment.author_email),
+ author_id: author,
created_at: comment.created_at,
updated_at: comment.updated_at
}