Commit f8d30ad2 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove subscribed field from APIs listing issues

Remove the subscribed field from todos, related issues, and epic issues
API. We do not intend to include this in APIs that render multiple
issuables because this triggers Markdown processing for all notes and
is very expensive to compute.

Changelog: fixed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60981
parent 3fed90cd
---
title: Remove subscribed field from todos, related issues, and epic issues API
merge_request: 60981
author:
type: fixed
...@@ -107,7 +107,6 @@ Example response: ...@@ -107,7 +107,6 @@ Example response:
"award_emoji": "http://localhost:3001/api/v4/projects/8/issues/6/award_emoji", "award_emoji": "http://localhost:3001/api/v4/projects/8/issues/6/award_emoji",
"project": "http://localhost:3001/api/v4/projects/8" "project": "http://localhost:3001/api/v4/projects/8"
}, },
"subscribed": true,
"epic_issue_id": 2 "epic_issue_id": 2
} }
] ]
......
...@@ -51,7 +51,6 @@ Parameters: ...@@ -51,7 +51,6 @@ Parameters:
"description" : null, "description" : null,
"updated_at" : "2016-01-07T12:44:33.959Z", "updated_at" : "2016-01-07T12:44:33.959Z",
"milestone" : null, "milestone" : null,
"subscribed" : true,
"user_notes_count": 0, "user_notes_count": 0,
"due_date": null, "due_date": null,
"web_url": "http://example.com/example/example/issues/14", "web_url": "http://example.com/example/example/issues/14",
......
...@@ -102,7 +102,6 @@ Example Response: ...@@ -102,7 +102,6 @@ Example Response:
}, },
"merge_when_pipeline_succeeds": false, "merge_when_pipeline_succeeds": false,
"merge_status": "cannot_be_merged", "merge_status": "cannot_be_merged",
"subscribed": true,
"user_notes_count": 7 "user_notes_count": 7
}, },
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7", "target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
...@@ -176,7 +175,6 @@ Example Response: ...@@ -176,7 +175,6 @@ Example Response:
}, },
"merge_when_pipeline_succeeds": false, "merge_when_pipeline_succeeds": false,
"merge_status": "cannot_be_merged", "merge_status": "cannot_be_merged",
"subscribed": true,
"user_notes_count": 7 "user_notes_count": 7
}, },
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7", "target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
......
...@@ -71,7 +71,8 @@ module API ...@@ -71,7 +71,8 @@ module API
present paginate(related_issues(epic)), present paginate(related_issues(epic)),
with: EE::API::Entities::EpicIssue, with: EE::API::Entities::EpicIssue,
current_user: current_user current_user: current_user,
include_subscribed: false
end end
end end
......
...@@ -21,12 +21,12 @@ module API ...@@ -21,12 +21,12 @@ module API
related_issues = source_issue.related_issues(current_user) do |issues| related_issues = source_issue.related_issues(current_user) do |issues|
issues.with_api_entity_associations.preload_awardable issues.with_api_entity_associations.preload_awardable
end end
related_issues.each { |issue| issue.lazy_subscription(current_user, user_project) } # preload subscriptions
present related_issues, present related_issues,
with: Entities::RelatedIssue, with: Entities::RelatedIssue,
current_user: current_user, current_user: current_user,
project: user_project project: user_project,
include_subscribed: false
end end
desc 'Relate issues' do desc 'Relate issues' do
......
...@@ -79,7 +79,7 @@ module API ...@@ -79,7 +79,7 @@ module API
next unless collection next unless collection
targets = collection.map(&:target) targets = collection.map(&:target)
options[type] = { issuable_metadata: Gitlab::IssuableMetadata.new(current_user, targets).data } options[type] = { issuable_metadata: Gitlab::IssuableMetadata.new(current_user, targets).data, include_subscribed: false }
end end
end end
end end
......
...@@ -195,7 +195,6 @@ RSpec.describe API::Issues do ...@@ -195,7 +195,6 @@ RSpec.describe API::Issues do
milestone = create(:milestone, project: project) milestone = create(:milestone, project: project)
create(:issue, project: project, milestone: milestone, closed_by: create(:user)) create(:issue, project: project, milestone: milestone, closed_by: create(:user))
create(:note_on_issue, project: project, noteable: issues[0])
create(:note_on_issue, project: project, noteable: issues[0]) create(:note_on_issue, project: project, noteable: issues[0])
create(:note_on_issue, project: project, noteable: issues[1]) create(:note_on_issue, project: project, noteable: issues[1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment