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