Commit 771dec84 authored by Stan Hu's avatar Stan Hu

Clean up implementation

parent ae7574f9
...@@ -56,7 +56,7 @@ module BitbucketServer ...@@ -56,7 +56,7 @@ module BitbucketServer
end end
def created_date def created_date
raw.dig('createdDate') raw['createdDate']
end end
end end
end end
......
...@@ -28,11 +28,11 @@ module BitbucketServer ...@@ -28,11 +28,11 @@ module BitbucketServer
end end
def author_username def author_username
author['username'] author['displayName']
end end
def author_email def author_email
author['displayName'] author['emailAddress']
end end
def note def note
...@@ -44,9 +44,22 @@ module BitbucketServer ...@@ -44,9 +44,22 @@ module BitbucketServer
end end
def updated_at def updated_at
Time.at(updated_date / 1000) if created_date.is_a?(Integer) Time.at(updated_date / 1000) if updated_date.is_a?(Integer)
end end
# Bitbucket Server supports the ability to reply to any comment
# and created multiple threads. It represents these as a linked list
# of comments within comments. For example:
#
# "comments": [
# {
# "author" : ...
# "comments": [
# {
# "author": ...
#
# Since GitLab only supports a single thread, we flatten all these
# comments into a single discussion.
def comments def comments
workset = [raw_comment['comments']].compact workset = [raw_comment['comments']].compact
all_comments = [] all_comments = []
...@@ -71,15 +84,15 @@ module BitbucketServer ...@@ -71,15 +84,15 @@ module BitbucketServer
end end
def author def author
raw_comment.fetch('author', {}) raw.dig('comment', 'author')
end end
def created_date def created_date
raw_comment['createdDate'] raw.dig('comment', 'createdDate')
end end
def updated_date def updated_date
raw_comment['updatedDate'] raw.dig('comment', 'updatedDate')
end end
end end
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