diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-11-13 21:36:18 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-11-20 12:38:53 -0200 |
commit | d2699aea57eaef6adee25bb453a6096b80dda28f (patch) | |
tree | be2ea704731ce5b7126271afa38f53d4f0c6e7e9 /app/models/issue.rb | |
parent | bd026b6a28ac410ad455b7b915cafc9782296b6b (diff) | |
download | gitlab-ce-d2699aea57eaef6adee25bb453a6096b80dda28f.tar.gz |
Add issue sidebar and toggle_subscription endpoint in board issues data
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index b5abc8f57b0..a9863a50d84 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -246,7 +246,12 @@ class Issue < ActiveRecord::Base def as_json(options = {}) super(options).tap do |json| - json[:subscribed] = subscribed?(options[:user], project) if options.key?(:user) && options[:user] + if options.key?(:sidebar_endpoints) && project + url_helper = Gitlab::Routing.url_helpers + + json.merge!(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)) + end if options.key?(:labels) json[:labels] = labels.as_json( |