Commit 5ba77a49 authored by George Koltsov's avatar George Koltsov

Add author lines to project import comments

parent f5fcb9a1
...@@ -4,7 +4,7 @@ module Bitbucket ...@@ -4,7 +4,7 @@ module Bitbucket
module Representation module Representation
class Comment < Representation::Base class Comment < Representation::Base
def author def author
user['username'] user['nickname']
end end
def note def note
......
...@@ -14,7 +14,7 @@ module Bitbucket ...@@ -14,7 +14,7 @@ module Bitbucket
end end
def author def author
raw.dig('reporter', 'username') raw.dig('reporter', 'nickname')
end end
def description def description
......
...@@ -4,7 +4,7 @@ module Bitbucket ...@@ -4,7 +4,7 @@ module Bitbucket
module Representation module Representation
class PullRequest < Representation::Base class PullRequest < Representation::Base
def author def author
raw.fetch('author', {}).fetch('username', nil) raw.fetch('author', {}).fetch('nickname', nil)
end end
def description def description
......
...@@ -260,15 +260,23 @@ module Gitlab ...@@ -260,15 +260,23 @@ module Gitlab
end end
def pull_request_comment_attributes(comment) def pull_request_comment_attributes(comment)
author_id = gitlab_user_id(project, comment.author)
{ {
project: project, project: project,
note: comment.note, note: comment_note(comment, author_id),
author_id: gitlab_user_id(project, comment.author), author_id: author_id,
created_at: comment.created_at, created_at: comment.created_at,
updated_at: comment.updated_at updated_at: comment.updated_at
} }
end end
def comment_note(comment, author_id)
note = ''
note += @formatter.author_line(comment.author) if author_id == project.creator_id
note + comment.note
end
def log_error(details) def log_error(details)
logger.error(log_base_data.merge(details)) logger.error(log_base_data.merge(details))
end end
......
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