Commit 85988037 authored by Nick Thomas's avatar Nick Thomas

Fix merge conflicts in multiple issue assignees support in QuickActions::InterpretService

parent 8dd241ad
......@@ -92,21 +92,11 @@ module QuickActions
desc 'Assign'
explanation do |users|
<<<<<<< HEAD
## EE-specific
users = issuable.is_a?(Issue) ? users : users.take(1)
"Assigns #{users.map(&:to_reference).to_sentence}."
end
params do
## EE-specific
issuable.is_a?(Issue) ? '@user1 @user2' : '@user'
=======
users = issuable.allows_multiple_assignees? ? users : users.take(1)
"Assigns #{users.map(&:to_reference).to_sentence}."
end
params do
issuable.allows_multiple_assignees? ? '@user1 @user2' : '@user'
>>>>>>> ce/master
end
condition do
current_user.can?(:"admin_#{issuable.to_ability_name}", project)
......@@ -117,11 +107,6 @@ module QuickActions
command :assign do |users|
next if users.empty?
<<<<<<< HEAD
if issuable.is_a?(Issue)
# EE specific. In CE we should replace one assignee with another
@updates[:assignee_ids] = issuable.assignees.pluck(:id) + users.map(&:id)
=======
@updates[:assignee_ids] =
if issuable.allows_multiple_assignees?
issuable.assignees.pluck(:id) + users.map(&:id)
......@@ -133,53 +118,21 @@ module QuickActions
desc do
if issuable.allows_multiple_assignees?
'Remove all or specific assignee(s)'
>>>>>>> ce/master
else
'Remove assignee'
end
end
<<<<<<< HEAD
desc do
if issuable.is_a?(Issue)
'Remove all or specific assignee(s)'
else
'Remove assignee'
end
end
explanation do
"Removes #{'assignee'.pluralize(issuable.assignees.size)} #{issuable.assignees.map(&:to_reference).to_sentence}"
end
params do
issuable.is_a?(Issue) ? '@user1 @user2' : ''
=======
explanation do
"Removes #{'assignee'.pluralize(issuable.assignees.size)} #{issuable.assignees.map(&:to_reference).to_sentence}."
end
params do
issuable.allows_multiple_assignees? ? '@user1 @user2' : ''
>>>>>>> ce/master
end
condition do
issuable.persisted? &&
issuable.assignees.any? &&
current_user.can?(:"admin_#{issuable.to_ability_name}", project)
end
<<<<<<< HEAD
command :unassign do |unassign_param = nil|
users = extract_users(unassign_param)
if issuable.is_a?(Issue)
@updates[:assignee_ids] =
if users.any?
issuable.assignees.pluck(:id) - users.map(&:id)
else
[]
end
else
@updates[:assignee_id] = nil
end
=======
parse_params do |unassign_param|
# When multiple users are assigned, all will be unassigned if multiple assignees are no longer allowed
extract_users(unassign_param) if issuable.allows_multiple_assignees?
......@@ -217,7 +170,6 @@ module QuickActions
else
[users.last.id]
end
>>>>>>> ce/master
end
desc 'Change assignee(s)'
......
......@@ -399,7 +399,6 @@ describe QuickActions::InterpretService, services: true do
let(:content) { "/assign @#{developer.username}" }
context 'Issue' do
<<<<<<< HEAD
it 'fetches assignees and populates them if content contains /assign' do
user = create(:user)
issue.assignees << user
......@@ -407,24 +406,14 @@ describe QuickActions::InterpretService, services: true do
_, updates = service.execute(content, issue)
expect(updates[:assignee_ids]).to match_array([developer.id, user.id])
=======
it 'fetches assignee and populates assignee_ids if content contains /assign' do
_, updates = service.execute(content, issue)
expect(updates[:assignee_ids]).to match_array([developer.id])
>>>>>>> ce/master
end
end
context 'Merge Request' do
<<<<<<< HEAD
it 'fetches assignee and populates assignee_id if content contains /assign' do
user = create(:user)
merge_request.update(assignee: user)
=======
it 'fetches assignee and populates assignee_ids if content contains /assign' do
>>>>>>> ce/master
_, updates = service.execute(content, merge_request)
expect(updates).to eq(assignee_ids: [developer.id])
......
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