Commit 0d661320 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '212329-related-issues-to-core_license-and-policy' into 'master'

[Related Issues to core] Change `related_issues` license feature to `blocked_issues`

See merge request gitlab-org/gitlab!39662
parents 8a9c7306 a0d7fef1
...@@ -231,6 +231,7 @@ class ProjectPolicy < BasePolicy ...@@ -231,6 +231,7 @@ class ProjectPolicy < BasePolicy
enable :admin_issue enable :admin_issue
enable :admin_label enable :admin_label
enable :admin_list enable :admin_list
enable :admin_issue_link
enable :read_commit_status enable :read_commit_status
enable :read_build enable :read_build
enable :read_container_image enable :read_container_image
...@@ -544,6 +545,7 @@ class ProjectPolicy < BasePolicy ...@@ -544,6 +545,7 @@ class ProjectPolicy < BasePolicy
rule { can?(:read_issue) }.policy do rule { can?(:read_issue) }.policy do
enable :read_design enable :read_design
enable :read_design_activity enable :read_design_activity
enable :read_issue_link
end end
# Design abilities could also be prevented in the issue policy. # Design abilities could also be prevented in the issue policy.
......
...@@ -10,6 +10,7 @@ class License < ApplicationRecord ...@@ -10,6 +10,7 @@ class License < ApplicationRecord
EES_FEATURES = %i[ EES_FEATURES = %i[
audit_events audit_events
blocked_issues
burndown_charts burndown_charts
code_owners code_owners
code_review_analytics code_review_analytics
...@@ -33,7 +34,6 @@ class License < ApplicationRecord ...@@ -33,7 +34,6 @@ class License < ApplicationRecord
project_merge_request_analytics project_merge_request_analytics
protected_refs_for_users protected_refs_for_users
push_rules push_rules
related_issues
repository_mirrors repository_mirrors
repository_size_limit repository_size_limit
seat_link seat_link
......
...@@ -7,7 +7,7 @@ module EE ...@@ -7,7 +7,7 @@ module EE
prepended do prepended do
with_scope :subject with_scope :subject
condition(:related_issues_disabled) { !@subject.feature_available?(:related_issues) } condition(:related_issues_disabled) { !@subject.feature_available?(:blocked_issues) }
with_scope :subject with_scope :subject
condition(:repository_mirrors_enabled) { @subject.feature_available?(:repository_mirrors) } condition(:repository_mirrors_enabled) { @subject.feature_available?(:repository_mirrors) }
...@@ -197,16 +197,11 @@ module EE ...@@ -197,16 +197,11 @@ module EE
rule { ~group_timelogs_available }.prevent :read_group_timelogs rule { ~group_timelogs_available }.prevent :read_group_timelogs
rule { can?(:read_issue) }.policy do
enable :read_issue_link
end
rule { can?(:guest_access) & iterations_available }.enable :read_iteration rule { can?(:guest_access) & iterations_available }.enable :read_iteration
rule { can?(:reporter_access) }.policy do rule { can?(:reporter_access) }.policy do
enable :admin_board enable :admin_board
enable :read_deploy_board enable :read_deploy_board
enable :admin_issue_link
enable :admin_epic_issue enable :admin_epic_issue
enable :read_group_timelogs enable :read_group_timelogs
end end
......
...@@ -173,7 +173,7 @@ RSpec.describe Projects::FeatureFlagIssuesController do ...@@ -173,7 +173,7 @@ RSpec.describe Projects::FeatureFlagIssuesController do
end end
it 'returns not found when related issues feature is unavailable' do it 'returns not found when related issues feature is unavailable' do
stub_licensed_features(related_issues: false) stub_licensed_features(blocked_issues: false)
feature_flag, _issue = setup feature_flag, _issue = setup
sign_in(developer) sign_in(developer)
...@@ -333,7 +333,7 @@ RSpec.describe Projects::FeatureFlagIssuesController do ...@@ -333,7 +333,7 @@ RSpec.describe Projects::FeatureFlagIssuesController do
end end
it 'does not create a link when the related issues feature is unavailable' do it 'does not create a link when the related issues feature is unavailable' do
stub_licensed_features(related_issues: false) stub_licensed_features(blocked_issues: false)
feature_flag, issue = setup feature_flag, issue = setup
sign_in(developer) sign_in(developer)
...@@ -401,7 +401,7 @@ RSpec.describe Projects::FeatureFlagIssuesController do ...@@ -401,7 +401,7 @@ RSpec.describe Projects::FeatureFlagIssuesController do
end end
it 'does not unlink the issue when the related issues feature is unavailable' do it 'does not unlink the issue when the related issues feature is unavailable' do
stub_licensed_features(related_issues: false) stub_licensed_features(blocked_issues: false)
feature_flag, issue, link = setup feature_flag, issue, link = setup
sign_in(developer) sign_in(developer)
......
...@@ -25,7 +25,7 @@ RSpec.describe Projects::IssueLinksController do ...@@ -25,7 +25,7 @@ RSpec.describe Projects::IssueLinksController do
end end
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
project.add_developer(user) project.add_developer(user)
end end
...@@ -58,7 +58,7 @@ RSpec.describe Projects::IssueLinksController do ...@@ -58,7 +58,7 @@ RSpec.describe Projects::IssueLinksController do
context 'when related issues are available on the project' do context 'when related issues are available on the project' do
before do before do
project.add_developer(user) project.add_developer(user)
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
stub_feature_flags(link_types: true) stub_feature_flags(link_types: true)
end end
...@@ -75,7 +75,7 @@ RSpec.describe Projects::IssueLinksController do ...@@ -75,7 +75,7 @@ RSpec.describe Projects::IssueLinksController do
context 'when related issues are not available on the project' do context 'when related issues are not available on the project' do
before do before do
stub_licensed_features(related_issues: false) stub_licensed_features(blocked_issues: false)
end end
it 'returns 403' do it 'returns 403' do
......
...@@ -16,7 +16,7 @@ RSpec.describe 'Related issues', :js do ...@@ -16,7 +16,7 @@ RSpec.describe 'Related issues', :js do
context 'widget visibility' do context 'widget visibility' do
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
end end
context 'when not logged in' do context 'when not logged in' do
...@@ -189,7 +189,7 @@ RSpec.describe 'Related issues', :js do ...@@ -189,7 +189,7 @@ RSpec.describe 'Related issues', :js do
let!(:issue_link_c) { create :issue_link, source: issue_a, target: issue_c } let!(:issue_link_c) { create :issue_link, source: issue_a, target: issue_c }
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
project.add_guest(user) project.add_guest(user)
gitlab_sign_in(user) gitlab_sign_in(user)
end end
...@@ -240,7 +240,7 @@ RSpec.describe 'Related issues', :js do ...@@ -240,7 +240,7 @@ RSpec.describe 'Related issues', :js do
context 'with related_issues enabled' do context 'with related_issues enabled' do
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
end end
context 'without existing related issues' do context 'without existing related issues' do
......
...@@ -75,7 +75,7 @@ RSpec.describe 'Feature flag issue links', :js do ...@@ -75,7 +75,7 @@ RSpec.describe 'Feature flag issue links', :js do
context 'when the related issues feature is unavailable' do context 'when the related issues feature is unavailable' do
before do before do
stub_licensed_features(related_issues: false, feature_flags: true) stub_licensed_features(blocked_issues: false, feature_flags: true)
end end
it 'does not show the related issues widget' do it 'does not show the related issues widget' do
......
...@@ -37,12 +37,8 @@ RSpec.describe ProjectPolicy do ...@@ -37,12 +37,8 @@ RSpec.describe ProjectPolicy do
context 'basic permissions' do context 'basic permissions' do
include_context 'ProjectPolicy context' include_context 'ProjectPolicy context'
let(:additional_guest_permissions) do
%i[read_issue_link]
end
let(:additional_reporter_permissions) do let(:additional_reporter_permissions) do
%i[read_software_license_policy admin_issue_link] %i[read_software_license_policy]
end end
let(:additional_developer_permissions) do let(:additional_developer_permissions) do
......
...@@ -8,7 +8,7 @@ RSpec.describe Projects::IssueLinksController do ...@@ -8,7 +8,7 @@ RSpec.describe Projects::IssueLinksController do
let(:issue) { create :issue, project: project } let(:issue) { create :issue, project: project }
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
end end
describe 'GET /*namespace_id/:project_id/issues/:issue_id/links' do describe 'GET /*namespace_id/:project_id/issues/:issue_id/links' do
......
...@@ -65,7 +65,7 @@ RSpec.describe Issues::MoveService do ...@@ -65,7 +65,7 @@ RSpec.describe Issues::MoveService do
let!(:issue_link_d) { create(:issue_link, source: authorized_issue_d, target: old_issue) } let!(:issue_link_d) { create(:issue_link, source: authorized_issue_d, target: old_issue) }
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
authorized_project.add_developer(user) authorized_project.add_developer(user)
authorized_project2.add_developer(user) authorized_project2.add_developer(user)
end end
......
...@@ -334,7 +334,7 @@ RSpec.describe Notes::QuickActionsService do ...@@ -334,7 +334,7 @@ RSpec.describe Notes::QuickActionsService do
context 'related issues are not enabled' do context 'related issues are not enabled' do
before do before do
stub_licensed_features(related_issues: false) stub_licensed_features(blocked_issues: false)
end end
it 'does not create issue relation' do it 'does not create issue relation' do
...@@ -344,7 +344,7 @@ RSpec.describe Notes::QuickActionsService do ...@@ -344,7 +344,7 @@ RSpec.describe Notes::QuickActionsService do
context 'related issues are enabled' do context 'related issues are enabled' do
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
end end
it 'creates issue relation' do it 'creates issue relation' do
......
...@@ -13,7 +13,7 @@ RSpec.describe IssueLinks::CreateService do ...@@ -13,7 +13,7 @@ RSpec.describe IssueLinks::CreateService do
end end
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
project.add_developer(user) project.add_developer(user)
end end
......
...@@ -9,7 +9,7 @@ RSpec.describe IssueLinks::ListService do ...@@ -9,7 +9,7 @@ RSpec.describe IssueLinks::ListService do
let(:user_role) { :developer } let(:user_role) { :developer }
before do before do
stub_licensed_features(related_issues: true) stub_licensed_features(blocked_issues: true)
project.add_role(user, user_role) project.add_role(user, user_role)
end end
......
...@@ -20,7 +20,7 @@ RSpec.describe ProjectPolicy do ...@@ -20,7 +20,7 @@ RSpec.describe ProjectPolicy do
read_project_for_iids read_issue_iid read_label read_project_for_iids read_issue_iid read_label
read_milestone read_snippet read_project_member read_note read_milestone read_snippet read_project_member read_note
create_project create_issue create_note upload_file create_merge_request_in create_project create_issue create_note upload_file create_merge_request_in
award_emoji read_release award_emoji read_release read_issue_link
] ]
end end
...@@ -30,7 +30,7 @@ RSpec.describe ProjectPolicy do ...@@ -30,7 +30,7 @@ RSpec.describe ProjectPolicy do
admin_issue admin_label admin_list read_commit_status read_build admin_issue admin_label admin_list read_commit_status read_build
read_container_image read_pipeline read_environment read_deployment read_container_image read_pipeline read_environment read_deployment
read_merge_request download_wiki_code read_sentry_issue read_metrics_dashboard_annotation read_merge_request download_wiki_code read_sentry_issue read_metrics_dashboard_annotation
metrics_dashboard read_confidential_issues metrics_dashboard read_confidential_issues admin_issue_link
] ]
end end
......
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