Commit 95777233 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'epic_iid' into 'master'

Disable epic quick actions for new epics

See merge request gitlab-org/gitlab!49470
parents 7f3a748a 6702edce
# frozen_string_literal: true
class UpdateInternalIdsLastValueForEpics < ActiveRecord::Migration[6.0]
class UpdateInternalIdsLastValueForEpicsRenamed < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
......
cbc6bfa122167e9a46edaa14351a73eeb10586fa0eb82f231c792384c9d7986c
\ No newline at end of file
5c429e8090fd779ba29a8bd78d69e78d1d5d143a6fd3097a715e178fb150d877
\ No newline at end of file
---
title: Disable epic quick actions when creating new epics
merge_request: 49470
author:
type: fixed
......@@ -90,7 +90,8 @@ module EE
end
def action_allowed?
quick_action_target.group&.feature_available?(:subepics) &&
quick_action_target.persisted? &&
quick_action_target.group&.feature_available?(:subepics) &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", quick_action_target)
end
......
......@@ -503,6 +503,12 @@ RSpec.describe QuickActions::InterpretService do
let(:target) { merge_request }
end
context 'when target epic is not persisted yet' do
let(:target) { build(:epic, group: group) }
it_behaves_like 'quick action is unavailable', :child_epic
end
context 'when passed child epic is nil' do
let(:child_epic) { nil }
......@@ -647,6 +653,12 @@ RSpec.describe QuickActions::InterpretService do
let(:target) { merge_request }
end
context 'when target epic is not persisted yet' do
let(:target) { build(:epic, group: group) }
it_behaves_like 'quick action is unavailable', :remove_child_epic
end
it_behaves_like 'epic relation is removed'
context 'when trying to remove child epic from a different epic' do
......@@ -1176,6 +1188,12 @@ RSpec.describe QuickActions::InterpretService do
it_behaves_like 'target epic does not exist', :parent
end
context 'when target epic is not persisted yet' do
let(:target) { build(:epic, group: group) }
it_behaves_like 'quick action is unavailable', :parent_epic
end
context 'when user has no permission to read epic' do
let(:content) { "/parent_epic #{epic2&.to_reference(epic)}" }
......@@ -1209,6 +1227,12 @@ RSpec.describe QuickActions::InterpretService do
end
end
context 'when target epic is not persisted yet' do
let(:target) { build(:epic, group: group) }
it_behaves_like 'quick action is unavailable', :remove_parent_epic
end
context 'when parent is not present' do
before do
epic.parent = nil
......
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'migrate', '20201202081429_update_internal_ids_last_value_for_epics.rb')
require Rails.root.join('db', 'migrate', '20201208081429_update_internal_ids_last_value_for_epics_renamed.rb')
RSpec.describe UpdateInternalIdsLastValueForEpics, :migration, schema: 20201124185639 do
RSpec.describe UpdateInternalIdsLastValueForEpicsRenamed, :migration, schema: 20201124185639 do
let(:namespaces) { table(:namespaces) }
let(:users) { table(:users) }
let(:epics) { table(:epics) }
......
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