Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2016-12-13 22:28:04 +0300
committerValery Sizov <valery@gitlab.com>2016-12-13 22:28:07 +0300
commite39f024029b46322c1bf24409fd5ce7bfcef2da5 (patch)
tree52664136981b70c409f2cfb8e43235596821eb19 /lib/bitbucket
parent0057ed1e69bc203d82fd3e8dfa6db7ea6a9b1de7 (diff)
BB importer: Adding created_by only when used is not found[ci skip]
Diffstat (limited to 'lib/bitbucket')
-rw-r--r--lib/bitbucket/representation/base.rb4
-rw-r--r--lib/bitbucket/representation/comment.rb2
-rw-r--r--lib/bitbucket/representation/issue.rb2
-rw-r--r--lib/bitbucket/representation/pull_request.rb2
-rw-r--r--lib/bitbucket/representation/user.rb6
5 files changed, 12 insertions, 4 deletions
diff --git a/lib/bitbucket/representation/base.rb b/lib/bitbucket/representation/base.rb
index 94adaacc9b5..fd622d333da 100644
--- a/lib/bitbucket/representation/base.rb
+++ b/lib/bitbucket/representation/base.rb
@@ -5,6 +5,10 @@ module Bitbucket
@raw = raw
end
+ def user_representation(raw)
+ User.new(raw)
+ end
+
def self.decorate(entries)
entries.map { |entry| new(entry)}
end
diff --git a/lib/bitbucket/representation/comment.rb b/lib/bitbucket/representation/comment.rb
index 94bc18cbfab..bc40f891cd3 100644
--- a/lib/bitbucket/representation/comment.rb
+++ b/lib/bitbucket/representation/comment.rb
@@ -2,7 +2,7 @@ module Bitbucket
module Representation
class Comment < Representation::Base
def author
- user.fetch('username', 'Anonymous')
+ user_representation(user)
end
def note
diff --git a/lib/bitbucket/representation/issue.rb b/lib/bitbucket/representation/issue.rb
index 6c8e9a4c244..90adfa3331a 100644
--- a/lib/bitbucket/representation/issue.rb
+++ b/lib/bitbucket/representation/issue.rb
@@ -12,7 +12,7 @@ module Bitbucket
end
def author
- raw.dig('reporter', 'username') || 'Anonymous'
+ user_representation(raw.fetch('reporter', {}))
end
def description
diff --git a/lib/bitbucket/representation/pull_request.rb b/lib/bitbucket/representation/pull_request.rb
index e7b1f99e9a6..96992003d24 100644
--- a/lib/bitbucket/representation/pull_request.rb
+++ b/lib/bitbucket/representation/pull_request.rb
@@ -2,7 +2,7 @@ module Bitbucket
module Representation
class PullRequest < Representation::Base
def author
- raw.fetch('author', {}).fetch('username', 'Anonymous')
+ user_representation(raw.fetch('author', {}))
end
def description
diff --git a/lib/bitbucket/representation/user.rb b/lib/bitbucket/representation/user.rb
index ba6b7667b49..6025a9f0653 100644
--- a/lib/bitbucket/representation/user.rb
+++ b/lib/bitbucket/representation/user.rb
@@ -2,7 +2,11 @@ module Bitbucket
module Representation
class User < Representation::Base
def username
- raw['username']
+ raw['username'] || 'Anonymous'
+ end
+
+ def uuid
+ raw['uuid']
end
end
end