Multiple issue assignee: resolve conflicts after merging upstream

This commit is contained in:
Valery Sizov 2017-05-05 18:22:54 +03:00
parent 40f51c8e81
commit 9c0f2485b5
2 changed files with 14 additions and 20 deletions

View file

@ -91,41 +91,35 @@ module SlashCommands
end
desc 'Assign'
explanation do |user|
"Assigns #{user.to_reference}." if user
explanation do |users|
"Assigns #{users.map(&:to_reference).to_sentence}." if users.any?
end
params '@user'
condition do
current_user.can?(:"admin_#{issuable.to_ability_name}", project)
end
<<<<<<< HEAD
command :assign do |assignee_param|
user_ids = extract_references(assignee_param, :user).map(&:id)
parse_params do |assignee_param|
users = extract_references(assignee_param, :user)
if user_ids.empty?
user_ids = User.where(username: assignee_param.split(' ').map(&:strip)).pluck(:id)
if users.empty?
users = User.where(username: assignee_param.split(' ').map(&:strip))
end
next if user_ids.empty?
users
end
command :assign do |users|
next if users.empty?
if issuable.is_a?(Issue)
@updates[:assignee_ids] = user_ids
@updates[:assignee_ids] = users.map(&:id)
else
@updates[:assignee_id] = user_ids.last
@updates[:assignee_id] = users.last.id
end
=======
parse_params do |assignee_param|
extract_references(assignee_param, :user).first ||
User.find_by(username: assignee_param)
end
command :assign do |user|
@updates[:assignee_id] = user.id if user
>>>>>>> 10c1bf2d77fd0ab21309d0b136cbc0ac11f56c77
end
desc 'Remove assignee'
explanation do
"Removes assignee #{issuable.assignee.to_reference}."
"Removes assignee #{issuable.assignees.first.to_reference}."
end
condition do
issuable.persisted? &&

View file

@ -874,7 +874,7 @@ describe SlashCommands::InterpretService, services: true do
describe 'unassign command' do
let(:content) { '/unassign' }
let(:issue) { create(:issue, project: project, assignee: developer) }
let(:issue) { create(:issue, project: project, assignees: [developer]) }
it 'includes current assignee reference' do
_, explanations = service.explain(content, issue)