diff options
author | Rémy Coutable <remy@rymai.me> | 2017-10-05 10:43:18 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-10-05 10:48:26 +0200 |
commit | a55e150177934145c3daeecb678cce1b16f0a3b8 (patch) | |
tree | 5b9e4fe9c800b0ffab2f08eb3b8b04dcd5ece464 /lib/github/representation/issue.rb | |
parent | f96b4f41412b4e974fe77a1b58d6570252fd62d9 (diff) | |
download | gitlab-ce-a55e150177934145c3daeecb678cce1b16f0a3b8.tar.gz |
Set `label_ids` and `assignee_ids` after the initial `save!`.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/github/representation/issue.rb')
-rw-r--r-- | lib/github/representation/issue.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/github/representation/issue.rb b/lib/github/representation/issue.rb index df3540a6e6c..c0a6d349e33 100644 --- a/lib/github/representation/issue.rb +++ b/lib/github/representation/issue.rb @@ -1,10 +1,6 @@ module Github module Representation class Issue < Representation::Issuable - def labels - raw['labels'] - end - def state raw['state'] == 'closed' ? 'closed' : 'opened' end @@ -13,13 +9,21 @@ module Github raw['comments'] > 0 end - def has_labels? - labels.count > 0 - end - def pull_request? raw['pull_request'].present? end + + def assigned? + raw['assignees'].present? + end + + def assignees + return [] unless assigned? + + @assignees ||= raw['assignees'].map do |user| + Github::Representation::User.new(user, options) + end + end end end end |