diff options
author | Phil Hughes <me@iamphill.com> | 2016-10-19 22:33:34 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-10-19 22:33:34 +0100 |
commit | fcf0a4a12d1ca17438a99c2b7bf334b82fa0e26e (patch) | |
tree | 8e109ee1d989f741fd7c1b0fd26cfdbf9a545b31 /app/models/issue.rb | |
parent | cd5e83b6d6da3bddbc44334a1bcdbac287b35fb4 (diff) | |
parent | c08435e3c25f0a7a705ed8a49b16dde176b41a40 (diff) | |
download | gitlab-ce-fcf0a4a12d1ca17438a99c2b7bf334b82fa0e26e.tar.gz |
Merge branch 'master' into issue-board-sidebar
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 89794290520..ef92ac27b46 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -138,6 +138,10 @@ class Issue < ActiveRecord::Base reference.to_i > 0 && reference.to_i <= Gitlab::Database::MAX_INT_VALUE end + def self.project_foreign_key + 'project_id' + end + def self.sort(method, excluded_labels: []) case method.to_s when 'due_date_asc' then order_due_date_asc @@ -278,6 +282,14 @@ class Issue < ActiveRecord::Base def as_json(options = {}) super(options).tap do |json| json[:subscribed] = subscribed?(options[:user]) if options.has_key?(:user) + + if options.has_key?(:labels) + json[:labels] = labels.as_json( + project: project, + only: [:id, :title, :description, :color, :priority], + methods: [:text_color] + ) + end end end end |