summaryrefslogtreecommitdiff
path: root/app/models/label.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-14 20:51:41 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:27 -0200
commit86e0b5d643df21503281115774da550e06a4e878 (patch)
tree1231f7b86bec02aa6a9663a6ec5cc7cefdbed4a0 /app/models/label.rb
parent3c2aaec1f2624ad4817e7ac52120985682afa448 (diff)
downloadgitlab-ce-86e0b5d643df21503281115774da550e06a4e878.tar.gz
Fix issue board related controllers to expose label priority per project
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index 1d775a83f96..6fd45d251a8 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -133,6 +133,12 @@ class Label < ActiveRecord::Base
end
end
+ def as_json(options = {})
+ super(options).tap do |json|
+ json[:priority] = priorities.find_by(project: options[:project]).try(:priority) if options.has_key?(:project)
+ end
+ end
+
private
def cross_project_reference?(source_project, target_project)