##// END OF EJS Templates
Fixed: issue move by non-admin broken by r2726 (#3354)....
Jean-Philippe Lang -
r2639:566d0a6ceb12
parent child
Show More
@@ -284,7 +284,7 class IssuesController < ApplicationController
284 # admin is allowed to move issues to any active (visible) project
284 # admin is allowed to move issues to any active (visible) project
285 @allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current))
285 @allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current))
286 else
286 else
287 User.current.memberships.each {|m| @allowed_projects << m.project if m.role.allowed_to?(:move_issues)}
287 User.current.memberships.each {|m| @allowed_projects << m.project if m.roles.detect {|r| r.allowed_to?(:move_issues)}}
288 end
288 end
289 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
289 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
290 @target_project ||= @project
290 @target_project ||= @project
@@ -905,14 +905,14 class IssuesControllerTest < Test::Unit::TestCase
905 end
905 end
906
906
907 def test_move_one_issue_to_another_project
907 def test_move_one_issue_to_another_project
908 @request.session[:user_id] = 1
908 @request.session[:user_id] = 2
909 post :move, :id => 1, :new_project_id => 2
909 post :move, :id => 1, :new_project_id => 2
910 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
910 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
911 assert_equal 2, Issue.find(1).project_id
911 assert_equal 2, Issue.find(1).project_id
912 end
912 end
913
913
914 def test_bulk_move_to_another_project
914 def test_bulk_move_to_another_project
915 @request.session[:user_id] = 1
915 @request.session[:user_id] = 2
916 post :move, :ids => [1, 2], :new_project_id => 2
916 post :move, :ids => [1, 2], :new_project_id => 2
917 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
917 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
918 # Issues moved to project 2
918 # Issues moved to project 2
@@ -924,7 +924,7 class IssuesControllerTest < Test::Unit::TestCase
924 end
924 end
925
925
926 def test_bulk_move_to_another_tracker
926 def test_bulk_move_to_another_tracker
927 @request.session[:user_id] = 1
927 @request.session[:user_id] = 2
928 post :move, :ids => [1, 2], :new_tracker_id => 2
928 post :move, :ids => [1, 2], :new_tracker_id => 2
929 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
929 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
930 assert_equal 2, Issue.find(1).tracker_id
930 assert_equal 2, Issue.find(1).tracker_id
@@ -932,7 +932,7 class IssuesControllerTest < Test::Unit::TestCase
932 end
932 end
933
933
934 def test_bulk_copy_to_another_project
934 def test_bulk_copy_to_another_project
935 @request.session[:user_id] = 1
935 @request.session[:user_id] = 2
936 assert_difference 'Issue.count', 2 do
936 assert_difference 'Issue.count', 2 do
937 assert_no_difference 'Project.find(1).issues.count' do
937 assert_no_difference 'Project.find(1).issues.count' do
938 post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}
938 post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}
General Comments 0
You need to be logged in to leave comments. Login now