mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-25 18:01:14 +00:00
Project.copy_from deletes enabled_modules on source (#20512).
Fix by Ondřej Ezr. git-svn-id: http://svn.redmine.org/redmine/trunk@14508 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
a6c0e0e886
commit
b5af1cb235
@ -751,7 +751,7 @@ class Project < ActiveRecord::Base
|
||||
# clear unique attributes
|
||||
attributes = project.attributes.dup.except('id', 'name', 'identifier', 'status', 'parent_id', 'lft', 'rgt')
|
||||
copy = Project.new(attributes)
|
||||
copy.enabled_modules = project.enabled_modules
|
||||
copy.enabled_module_names = project.enabled_module_names
|
||||
copy.trackers = project.trackers
|
||||
copy.custom_values = project.custom_values.collect {|v| v.clone}
|
||||
copy.issue_custom_fields = project.issue_custom_fields
|
||||
|
||||
@ -723,13 +723,26 @@ class ProjectTest < ActiveSupport::TestCase
|
||||
|
||||
# Duplicated attributes
|
||||
assert_equal source_project.description, copied_project.description
|
||||
assert_equal source_project.enabled_modules, copied_project.enabled_modules
|
||||
assert_equal source_project.trackers, copied_project.trackers
|
||||
|
||||
# Default attributes
|
||||
assert_equal 1, copied_project.status
|
||||
end
|
||||
|
||||
def test_copy_from_should_copy_enabled_modules
|
||||
source = Project.generate!
|
||||
source.enabled_module_names = %w(issue_tracking wiki)
|
||||
|
||||
copy = Project.copy_from(source)
|
||||
copy.name = 'Copy'
|
||||
copy.identifier = 'copy'
|
||||
assert_difference 'EnabledModule.count', 2 do
|
||||
copy.save!
|
||||
end
|
||||
assert_equal 2, copy.reload.enabled_modules.count
|
||||
assert_equal 2, source.reload.enabled_modules.count
|
||||
end
|
||||
|
||||
def test_activities_should_use_the_system_activities
|
||||
project = Project.find(1)
|
||||
assert_equal project.activities.to_a, TimeEntryActivity.where(:active => true).to_a
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user