Commit c6238269 authored by Eugenia Grieff's avatar Eugenia Grieff Committed by Rajat Jain

Update param name to use epic_id

Use epic_id to reflect the param value that will
then be coverted to be the new epic param to later
be used by the UpdateService.
parent 55c21125
......@@ -87,7 +87,7 @@ export default {
issuable_ids: this.form.find('input[name="update[issuable_ids]"]').val(),
subscription_event: this.form.find('input[name="update[subscription_event]"]').val(),
health_status: this.form.find('input[name="update[health_status]"]').val(),
epic: this.form.find('input[name="update[epic_id]"]').val(),
epic_id: this.form.find('input[name="update[epic_id]"]').val(),
add_label_ids: [],
remove_label_ids: [],
},
......
......@@ -8,7 +8,7 @@ module EE
EE_PERMITTED_KEYS = %w[
weight
health_status
epic
epic_id
].freeze
private
......
......@@ -26,6 +26,9 @@ module EE
super
set_health_status
set_epic_param
params
end
def set_health_status
......@@ -34,39 +37,33 @@ module EE
params[:health_status] = nil if params[:health_status] == IssuableFinder::Params::NONE.to_s
end
override :filter_update_params
def filter_update_params(type)
super
set_epic_param
params
end
def set_epic_param
return unless params[:epic].present?
return unless params[:epic_id].present?
epic_param = params.delete(:epic)
params[:epic] = nil if remove_epic?(epic_param)
return if params[:epic].present?
epic_id = params.delete(:epic_id)
epic = find_epic(epic_id)
epic = find_epic(epic_param)
params[:epic] = epic if epic.present?
# Set as nil if removing an epic or set as the Epic object
# if epic_id is present and the Epic was found.
params[:epic] = epic if epic.nil? || epic.present?
end
# rubocop: disable CodeReuse/ActiveRecord
def find_epic(id)
def find_epic(epic_id)
return if remove_epic?(epic_id)
group = parent.is_a?(Group) ? parent : parent.group
return unless group.present?
EpicsFinder.new(current_user, group_id: group.id,
include_ancestor_groups: true).find(id)
include_ancestor_groups: true).find(epic_id)
rescue ActiveRecord::RecordNotFound
nil
false
end
# rubocop: enable CodeReuse/ActiveRecord
def remove_epic?(epic_param)
epic_param == IssuableFinder::Params::NONE.to_s
def remove_epic?(epic_id)
epic_id == IssuableFinder::Params::NONE.to_s
end
end
end
......
- group = local_assigns.fetch(:group)
- type = local_assigns.fetch(:type)
- bulk_issue_health_status_flag = type == :issues && Feature.enabled?(:bulk_update_health_status, group) && group&.feature_available?(:issuable_health_status)
- epic_bulk_edit_flag = group&.feature_available?(:epics) && type == :issues
- epic_bulk_edit_flag = type == :issues && group&.feature_available?(:epics)
%aside.issues-bulk-update.js-right-sidebar.right-sidebar{ 'aria-live' => 'polite', data: { 'signed-in': current_user.present? } }
.issuable-sidebar.hidden
......
......@@ -19,7 +19,7 @@ RSpec.describe Groups::IssuesController do
update: {
milestone_id: milestone.id,
issuable_ids: "#{issue1.id}, #{issue2.id}",
epic: epic.id
epic_id: epic.id
},
group_id: group
}
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe 'Issues > Epic bulk assignment' do
RSpec.describe 'Issues > Epic bulk assignment', :js do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, :public, group: group) }
......
......@@ -98,7 +98,7 @@ RSpec.describe Issuable::BulkUpdateService do
context 'when user can not admin epic' do
let(:epic3) { create(:epic, group: create(:group)) }
let(:params) { { issuable_ids: issuables.map(&:id), epic: epic3.id } }
let(:params) { { issuable_ids: issuables.map(&:id), epic_id: epic3.id } }
it_behaves_like 'does not update issuables attribute', :epic
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