summaryrefslogtreecommitdiff
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-11-09 13:19:48 +1300
committerThong Kuah <tkuah@gitlab.com>2018-11-09 13:19:48 +1300
commit03dba01273d548ab8c0dd82408400a834fb4e10f (patch)
treef5d5da30035fbfa84922d11b3328ed3866382914 /app/models/issue.rb
parentab61bee378ed45ff01d74742b54149533811a204 (diff)
downloadgitlab-ce-03dba01273d548ab8c0dd82408400a834fb4e10f.tar.gz
Revert "Extract code into IssueBoardEntity"revert_issue_board_entity
This reverts commit 8c126525faba40032244328187ba73a53b6eaf4c.
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index abdb3448d4e..0de5e434b02 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -231,6 +231,20 @@ class Issue < ActiveRecord::Base
def as_json(options = {})
super(options).tap do |json|
+ if options.key?(:issue_endpoints) && project
+ url_helper = Gitlab::Routing.url_helpers
+
+ issue_reference = options[:include_full_project_path] ? to_reference(full: true) : to_reference
+
+ json.merge!(
+ reference_path: issue_reference,
+ real_path: url_helper.project_issue_path(project, self),
+ issue_sidebar_endpoint: url_helper.project_issue_path(project, self, format: :json, serializer: 'sidebar'),
+ toggle_subscription_endpoint: url_helper.toggle_subscription_project_issue_path(project, self),
+ assignable_labels_endpoint: url_helper.project_labels_path(project, format: :json, include_ancestor_groups: true)
+ )
+ end
+
if options.key?(:labels)
json[:labels] = labels.as_json(
project: project,