Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10903 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
16441b4938
commit
88d5663ad2
@ -116,11 +116,7 @@ class ProjectsController < ApplicationController
|
|||||||
@source_project = Project.find(params[:id])
|
@source_project = Project.find(params[:id])
|
||||||
if request.get?
|
if request.get?
|
||||||
@project = Project.copy_from(@source_project)
|
@project = Project.copy_from(@source_project)
|
||||||
if @project
|
@project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
|
||||||
@project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
|
|
||||||
else
|
|
||||||
redirect_to :controller => 'admin', :action => 'projects'
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Mailer.with_deliveries(params[:notifications] == '1') do
|
Mailer.with_deliveries(params[:notifications] == '1') do
|
||||||
@project = Project.new
|
@project = Project.new
|
||||||
@ -139,7 +135,8 @@ class ProjectsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
redirect_to :controller => 'admin', :action => 'projects'
|
# source_project not found
|
||||||
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
# Show @project
|
# Show @project
|
||||||
|
@ -523,6 +523,12 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||||||
:attributes => {:name => 'project[enabled_module_names][]', :value => 'issue_tracking'}
|
:attributes => {:name => 'project[enabled_module_names][]', :value => 'issue_tracking'}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_get_copy_with_invalid_source_should_respond_with_404
|
||||||
|
@request.session[:user_id] = 1
|
||||||
|
get :copy, :id => 99
|
||||||
|
assert_response 404
|
||||||
|
end
|
||||||
|
|
||||||
def test_post_copy_should_copy_requested_items
|
def test_post_copy_should_copy_requested_items
|
||||||
@request.session[:user_id] = 1 # admin
|
@request.session[:user_id] = 1 # admin
|
||||||
CustomField.delete_all
|
CustomField.delete_all
|
||||||
|
Loading…
x
Reference in New Issue
Block a user