Commit a91101b1 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make it possible to move issue if user is a reporter

Discussed it here:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2831#note_4190228
parent 310b417b
......@@ -223,7 +223,6 @@ class Ability
:admin_project,
:admin_commit_status,
:admin_build,
:move_issue
]
end
......
......@@ -39,8 +39,8 @@ module Issues
private
def can_move?
can?(@current_user, :move_issue, @project_old) &&
can?(@current_user, :move_issue, @project_new)
can?(@current_user, :admin_issue, @project_old) &&
can?(@current_user, :admin_issue, @project_new)
end
def open_new_issue
......
......@@ -67,7 +67,7 @@
- if can? current_user, :admin_label, issuable.project
= link_to 'Create new label', new_namespace_project_label_path(issuable.project.namespace, issuable.project), target: :blank
- if issuable.is_a?(Issue) && can?(current_user, :move_issue, issuable.project)
- if issuable.is_a?(Issue) && can?(current_user, :admin_issue, issuable.project)
%hr
.form-group
= f.label :move_to_project_id, 'Move', class: 'control-label'
......
......@@ -24,8 +24,8 @@ describe Issues::MoveService, services: true do
shared_context 'user can move issue' do
before do
old_project.team << [user, :master]
new_project.team << [user, :master]
old_project.team << [user, :reporter]
new_project.team << [user, :reporter]
end
end
......@@ -186,25 +186,25 @@ describe Issues::MoveService, services: true do
describe '#move?' do
subject { move_service.move? }
context 'user is master in both projects' do
context 'user is reporter in both projects' do
include_context 'user can move issue'
it { is_expected.to be_truthy }
end
context 'user is master only in new project' do
before { new_project.team << [user, :master] }
context 'user is reporter only in new project' do
before { new_project.team << [user, :reporter] }
it { is_expected.to be_falsey }
end
context 'user is master only in old project' do
before { old_project.team << [user, :master] }
context 'user is reporter only in old project' do
before { old_project.team << [user, :reporter] }
it { is_expected.to be_falsey }
end
context 'user is master in one project and developer in another' do
context 'user is reporter in one project and guest in another' do
before do
new_project.team << [user, :developer]
old_project.team << [user, :master]
new_project.team << [user, :guest]
old_project.team << [user, :reporter]
end
it { is_expected.to be_falsey }
......
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