Add author lines to project import comments
This commit is contained in:
parent
f5fcb9a1be
commit
5ba77a4999
4 changed files with 13 additions and 5 deletions
|
@ -4,7 +4,7 @@ module Bitbucket
|
|||
module Representation
|
||||
class Comment < Representation::Base
|
||||
def author
|
||||
user['username']
|
||||
user['nickname']
|
||||
end
|
||||
|
||||
def note
|
||||
|
|
|
@ -14,7 +14,7 @@ module Bitbucket
|
|||
end
|
||||
|
||||
def author
|
||||
raw.dig('reporter', 'username')
|
||||
raw.dig('reporter', 'nickname')
|
||||
end
|
||||
|
||||
def description
|
||||
|
|
|
@ -4,7 +4,7 @@ module Bitbucket
|
|||
module Representation
|
||||
class PullRequest < Representation::Base
|
||||
def author
|
||||
raw.fetch('author', {}).fetch('username', nil)
|
||||
raw.fetch('author', {}).fetch('nickname', nil)
|
||||
end
|
||||
|
||||
def description
|
||||
|
|
|
@ -260,15 +260,23 @@ module Gitlab
|
|||
end
|
||||
|
||||
def pull_request_comment_attributes(comment)
|
||||
author_id = gitlab_user_id(project, comment.author)
|
||||
|
||||
{
|
||||
project: project,
|
||||
note: comment.note,
|
||||
author_id: gitlab_user_id(project, comment.author),
|
||||
note: comment_note(comment, author_id),
|
||||
author_id: author_id,
|
||||
created_at: comment.created_at,
|
||||
updated_at: comment.updated_at
|
||||
}
|
||||
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)
|
||||
logger.error(log_base_data.merge(details))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue