Skip to content
Snippets Groups Projects
Commit 7d20a91b authored by Phil Hughes's avatar Phil Hughes
Browse files

Restore subscribe status in JSON

parent 1aff95c7
No related branches found
No related tags found
1 merge request!6690Issue board sidebar
Pipeline #
Loading
@@ -76,8 +76,11 @@ module Projects
Loading
@@ -76,8 +76,11 @@ module Projects
only: [:iid, :title, :confidential, :due_date], only: [:iid, :title, :confidential, :due_date],
include: { include: {
assignee: { only: [:id, :name, :username], methods: [:avatar_url] }, assignee: { only: [:id, :name, :username], methods: [:avatar_url] },
labels: { only: [:id, :title, :description, :color, :priority], methods: [:text_color] } labels: { only: [:id, :title, :description, :color, :priority], methods: [:text_color] },
}) milestone: { only: [:id, :title] }
},
user: current_user
)
end end
end end
end end
Loading
Loading
Loading
@@ -274,4 +274,10 @@ class Issue < ActiveRecord::Base
Loading
@@ -274,4 +274,10 @@ class Issue < ActiveRecord::Base
def check_for_spam? def check_for_spam?
project.public? project.public?
end end
def as_json(options = {})
super(options).tap do |json|
json[:subscribed] = subscribed?(options[:user]) if options.has_key?(:user)
end
end
end end
Loading
@@ -20,9 +20,11 @@ describe Projects::Boards::IssuesController do
Loading
@@ -20,9 +20,11 @@ describe Projects::Boards::IssuesController do
context 'with valid list id' do context 'with valid list id' do
it 'returns issues that have the list label applied' do it 'returns issues that have the list label applied' do
johndoe = create(:user, avatar: fixture_file_upload(File.join(Rails.root, 'spec/fixtures/dk.png'))) johndoe = create(:user, avatar: fixture_file_upload(File.join(Rails.root, 'spec/fixtures/dk.png')))
issue = create(:labeled_issue, project: project, labels: [planning])
create(:labeled_issue, project: project, labels: [planning]) create(:labeled_issue, project: project, labels: [planning])
create(:labeled_issue, project: project, labels: [development], due_date: Date.tomorrow) create(:labeled_issue, project: project, labels: [development], due_date: Date.tomorrow)
create(:labeled_issue, project: project, labels: [development], assignee: johndoe) create(:labeled_issue, project: project, labels: [development], assignee: johndoe)
issue.subscribe(johndoe)
   
list_issues user: user, list_id: list2 list_issues user: user, list_id: list2
   
Loading
Loading
Loading
@@ -43,7 +43,8 @@
Loading
@@ -43,7 +43,8 @@
"name": { "type": "string" }, "name": { "type": "string" },
"username": { "type": "string" }, "username": { "type": "string" },
"avatar_url": { "type": "uri" } "avatar_url": { "type": "uri" }
} },
"subscribed": { "type": ["boolean", "null"] }
}, },
"additionalProperties": false "additionalProperties": false
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment