Commit 070abce6 authored by Imre Farkas's avatar Imre Farkas

Merge branch 'remove-issue_link_types' into 'master'

Remove issue_link_types flag

Closes #38350

See merge request gitlab-org/gitlab!24175
parents 86a1ac23 0b01577b
---
title: Expose issue link type in REST API
merge_request: 24175
author:
type: added
...@@ -67,7 +67,7 @@ POST /projects/:id/issues/:issue_iid/links ...@@ -67,7 +67,7 @@ POST /projects/:id/issues/:issue_iid/links
| `issue_iid` | integer | yes | The internal ID of a project's issue | | `issue_iid` | integer | yes | The internal ID of a project's issue |
| `target_project_id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) of a target project | | `target_project_id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) of a target project |
| `target_issue_iid` | integer/string | yes | The internal ID of a target project's issue | | `target_issue_iid` | integer/string | yes | The internal ID of a target project's issue |
| `link_type` | string | no | The type of the relation ("relates_to", "blocks", "is_blocked_by"), defaults to "relates_to"). Ignored unless `issue_link_types` feature flag is enabled. | | `link_type` | string | no | The type of the relation ("relates_to", "blocks", "is_blocked_by"), defaults to "relates_to"). |
```shell ```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues/1/links?target_project_id=5&target_issue_iid=1" curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues/1/links?target_project_id=5&target_issue_iid=1"
......
...@@ -11,7 +11,7 @@ class LinkedProjectIssueEntity < LinkedIssueEntity ...@@ -11,7 +11,7 @@ class LinkedProjectIssueEntity < LinkedIssueEntity
end end
end end
expose :link_type, if: -> (*) { Feature.enabled?(:issue_link_types, issuable.project) } do |issue| expose :link_type do |issue|
issue.issue_link_type issue.issue_link_type
end end
......
...@@ -5,7 +5,7 @@ module IssueLinks ...@@ -5,7 +5,7 @@ module IssueLinks
def relate_issuables(referenced_issue) def relate_issuables(referenced_issue)
attrs = { source: issuable, target: referenced_issue } attrs = { source: issuable, target: referenced_issue }
if ::Feature.enabled?(:issue_link_types, issuable.project) && params[:link_type].present? if params[:link_type].present?
attrs[:link_type] = params[:link_type] attrs[:link_type] = params[:link_type]
end end
......
...@@ -31,7 +31,7 @@ module API ...@@ -31,7 +31,7 @@ module API
requires :target_project_id, type: String, desc: 'The ID of the target project' requires :target_project_id, type: String, desc: 'The ID of the target project'
requires :target_issue_iid, type: Integer, desc: 'The IID of the target issue' requires :target_issue_iid, type: Integer, desc: 'The IID of the target issue'
optional :link_type, type: String, values: IssueLink.link_types.keys, optional :link_type, type: String, values: IssueLink.link_types.keys,
desc: 'The type of the relation. Ignored unless `issue_link_types` feature flag is enabled.' desc: 'The type of the relation'
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
post ':id/issues/:issue_iid/links' do post ':id/issues/:issue_iid/links' do
......
...@@ -29,36 +29,14 @@ describe Projects::IssueLinksController do ...@@ -29,36 +29,14 @@ describe Projects::IssueLinksController do
project.add_developer(user) project.add_developer(user)
end end
context 'when issue_link_types is enabled' do it 'returns success response' do
before do get_link(user, issue1)
stub_feature_flags(issue_link_types: true)
end
it 'returns success response' do
get_link(user, issue1)
expect(response).to have_gitlab_http_status(:ok)
link = json_response.first
expect(link['id']).to eq(issue2.id)
expect(link['link_type']).to eq('is_blocked_by')
end
end
context 'when issue_link_types is disabled' do
before do
stub_feature_flags(issue_link_types: false)
end
it 'does not return issue_link_type' do expect(response).to have_gitlab_http_status(:ok)
get_link(user, issue1)
expect(response).to have_gitlab_http_status(:ok) link = json_response.first
expect(link['id']).to eq(issue2.id)
link = json_response.first expect(link['link_type']).to eq('is_blocked_by')
expect(link['id']).to eq(issue2.id)
expect(link).not_to include('link_type')
end
end end
end end
......
...@@ -421,7 +421,7 @@ describe 'Related issues', :js do ...@@ -421,7 +421,7 @@ describe 'Related issues', :js do
end end
end end
context 'with issue_link_types feature flag enabled' do describe 'issue link types' do
def add_linked_issue(issue, radio_input_value) def add_linked_issue(issue, radio_input_value)
find('.js-issue-count-badge-add-button').click find('.js-issue-count-badge-add-button').click
find('.js-add-issuable-form-input').set "#{issue.to_reference(project)} " find('.js-add-issuable-form-input').set "#{issue.to_reference(project)} "
...@@ -432,7 +432,6 @@ describe 'Related issues', :js do ...@@ -432,7 +432,6 @@ describe 'Related issues', :js do
end end
before do before do
stub_feature_flags(issue_link_types: true)
visit project_issue_path(project, issue_a) visit project_issue_path(project, issue_a)
wait_for_requests wait_for_requests
end end
...@@ -521,35 +520,6 @@ describe 'Related issues', :js do ...@@ -521,35 +520,6 @@ describe 'Related issues', :js do
end end
end end
end end
context 'with issue_link_types feature flag disabled' do
before do
stub_feature_flags(issue_link_types: false)
visit project_issue_path(project, issue_b)
wait_for_requests
end
context 'when adding an issue' do
before do
find('.js-issue-count-badge-add-button').click
find('.js-add-issuable-form-input').set "#{issue_c.to_reference(project)} "
find('.js-add-issuable-form-add-button').click
wait_for_requests
end
it 'does not group it into "Blocks", "Is blocked by", or "Relates to" headings' do
headings = all('.linked-issues-card-body h4')
expect(headings.count).to eq(0)
end
it 'shows the added issue' do
items = all('.item-title a')
expect(items.count).to eq(1)
end
end
end
end end
end end
end end
...@@ -126,19 +126,6 @@ describe API::IssueLinks do ...@@ -126,19 +126,6 @@ describe API::IssueLinks do
expect_link_response(link_type: 'blocks') expect_link_response(link_type: 'blocks')
end end
context 'when `issue_link_types` is disabled' do
before do
stub_feature_flags(issue_link_types: false)
end
it 'ignores `link_type` parameter' do
post api("/projects/#{project.id}/issues/#{issue.iid}/links", user),
params: { target_project_id: project.id, target_issue_iid: target_issue.iid, link_type: 'blocks' }
expect_link_response
end
end
it 'returns 201 when sending full path of target project' do it 'returns 201 when sending full path of target project' do
post api("/projects/#{project.id}/issues/#{issue.iid}/links", user), post api("/projects/#{project.id}/issues/#{issue.iid}/links", user),
params: { target_project_id: project.full_path, target_issue_iid: target_issue.iid } params: { target_project_id: project.full_path, target_issue_iid: target_issue.iid }
......
...@@ -18,36 +18,6 @@ describe LinkedProjectIssueEntity do ...@@ -18,36 +18,6 @@ describe LinkedProjectIssueEntity do
end end
describe 'issue_link_type' do describe 'issue_link_type' do
context 'when issue_link_types is enabled' do it { expect(entity.as_json).to include(link_type: 'relates_to') }
before do
stub_feature_flags(issue_link_types: true)
end
it { expect(entity.as_json).to include(link_type: 'relates_to') }
end
context 'when issue_link_types is disabled' do
before do
stub_feature_flags(issue_link_types: false)
end
it { expect(entity.as_json).not_to include(:link_type) }
end
context 'when issue_link_types is not enabled for target issue project' do
before do
stub_feature_flags(issue_link_types: { thing: issue_link.target.project, enabled: false })
end
it { expect(entity.as_json).to include(link_type: 'relates_to') }
end
context 'when issue_link_types is not enabled for source issue project' do
before do
stub_feature_flags(issue_link_types: { thing: issue_link.source.project, enabled: false })
end
it { expect(entity.as_json).not_to include(:link_type) }
end
end end
end end
...@@ -120,19 +120,6 @@ describe IssueLinks::CreateService do ...@@ -120,19 +120,6 @@ describe IssueLinks::CreateService do
subject subject
end end
context 'when issue_link_types is disabled' do
before do
stub_feature_flags(issue_link_types: false)
end
it 'creates links with default type' do
expect { subject }.to change(IssueLink, :count).from(0).to(2)
expect(IssueLink.find_by!(target: issue_a)).to have_attributes(source: issue, link_type: 'relates_to')
expect(IssueLink.find_by!(target: another_project_issue)).to have_attributes(source: issue, link_type: 'relates_to')
end
end
end end
context 'when reference of any already related issue is present' do context 'when reference of any already related issue is present' do
......
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