Commit 939cff89 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'tc-follow-up-mia' into 'master'

Follow-up from "Namespace license checks for multiple assignees"

Closes gitlab-ee#2839

See merge request !12701
parents c88739ff acbad6d8
...@@ -146,32 +146,6 @@ module QuickActions ...@@ -146,32 +146,6 @@ module QuickActions
end end
end end
desc do
"Change assignee#{'(s)' if issuable.allows_multiple_assignees?}"
end
explanation do |users|
users = issuable.allows_multiple_assignees? ? users : users.take(1)
"Change #{'assignee'.pluralize(users.size)} to #{users.map(&:to_reference).to_sentence}."
end
params do
issuable.allows_multiple_assignees? ? '@user1 @user2' : '@user'
end
condition do
issuable.persisted? &&
current_user.can?(:"admin_#{issuable.to_ability_name}", project)
end
parse_params do |assignee_param|
extract_users(assignee_param)
end
command :reassign do |users|
@updates[:assignee_ids] =
if issuable.allows_multiple_assignees?
users.map(&:id)
else
[users.last.id]
end
end
desc 'Set milestone' desc 'Set milestone'
explanation do |milestone| explanation do |milestone|
"Sets the milestone to #{milestone.to_reference}." if milestone "Sets the milestone to #{milestone.to_reference}." if milestone
......
---
title: Undo adding the /reassign quick action
merge_request: 12701
author:
...@@ -23,7 +23,7 @@ describe 'New/edit issue', :feature, :js do ...@@ -23,7 +23,7 @@ describe 'New/edit issue', :feature, :js do
visit new_project_issue_path(project) visit new_project_issue_path(project)
end end
describe 'shorten users API pagination limit (CE)' do describe 'shorten users API pagination limit' do
before do before do
# Using `allow_any_instance_of`/`and_wrap_original`, `original` would # Using `allow_any_instance_of`/`and_wrap_original`, `original` would
# somehow refer to the very block we defined to _wrap_ that method, instead of # somehow refer to the very block we defined to _wrap_ that method, instead of
...@@ -63,7 +63,7 @@ describe 'New/edit issue', :feature, :js do ...@@ -63,7 +63,7 @@ describe 'New/edit issue', :feature, :js do
end end
end end
describe 'single assignee (CE)' do describe 'single assignee' do
before do before do
click_button 'Unassigned' click_button 'Unassigned'
......
...@@ -772,7 +772,7 @@ describe API::Issues do ...@@ -772,7 +772,7 @@ describe API::Issues do
end end
end end
context 'CE restrictions' do context 'single assignee restrictions' do
it 'creates a new project issue with no more than one assignee' do it 'creates a new project issue with no more than one assignee' do
post api("/projects/#{project.id}/issues", user), post api("/projects/#{project.id}/issues", user),
title: 'new issue', assignee_ids: [user2.id, guest.id] title: 'new issue', assignee_ids: [user2.id, guest.id]
...@@ -1123,7 +1123,7 @@ describe API::Issues do ...@@ -1123,7 +1123,7 @@ describe API::Issues do
expect(json_response['assignees'].first['name']).to eq(user2.name) expect(json_response['assignees'].first['name']).to eq(user2.name)
end end
context 'CE restrictions' do context 'single assignee restrictions' do
it 'updates an issue with several assignees but only one has been applied' do it 'updates an issue with several assignees but only one has been applied' do
put api("/projects/#{project.id}/issues/#{issue.iid}", user), put api("/projects/#{project.id}/issues/#{issue.iid}", user),
assignee_ids: [user2.id, guest.id] assignee_ids: [user2.id, guest.id]
......
...@@ -431,22 +431,6 @@ describe QuickActions::InterpretService, services: true do ...@@ -431,22 +431,6 @@ describe QuickActions::InterpretService, services: true do
end end
end end
context 'reassign command' do
let(:content) { '/reassign' }
context 'Issue' do
it 'reassigns user if content contains /reassign @user' do
user = create(:user)
issue.update(assignee_ids: [developer.id])
_, updates = service.execute("/reassign @#{user.username}", issue)
expect(updates).to eq(assignee_ids: [user.id])
end
end
end
it_behaves_like 'milestone command' do it_behaves_like 'milestone command' do
let(:content) { "/milestone %#{milestone.title}" } let(:content) { "/milestone %#{milestone.title}" }
let(:issuable) { issue } let(:issuable) { issue }
......
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