diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-11-29 20:08:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-11-29 20:08:14 +0000 |
commit | 2cf11bd64e7b272171f72cac1572e26224daf4ca (patch) | |
tree | 00a7aa2a9c18f16e4a2f099173e189d349097330 | |
parent | bf6e02c7394a468ac4a385c179e2eb7c3769eb52 (diff) | |
download | redmine-2cf11bd64e7b272171f72cac1572e26224daf4ca.tar.gz redmine-2cf11bd64e7b272171f72cac1572e26224daf4ca.zip |
Fixed Mantis importer: projects trackers and modules assignment
Fixed Trac and Mantis importers: roles assignments
git-svn-id: http://redmine.rubyforge.org/svn/trunk@936 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | lib/tasks/migrate_from_mantis.rake | 10 | ||||
-rw-r--r-- | lib/tasks/migrate_from_trac.rake | 11 | ||||
-rw-r--r-- | test/functional/search_controller_test.rb | 5 |
3 files changed, 18 insertions, 8 deletions
diff --git a/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake index fff668b64..593d59d82 100644 --- a/lib/tasks/migrate_from_mantis.rake +++ b/lib/tasks/migrate_from_mantis.rake @@ -53,9 +53,10 @@ task :migrate_from_mantis => :environment do TRACKER_BUG = Tracker.find_by_position(1)
TRACKER_FEATURE = Tracker.find_by_position(2)
- DEFAULT_ROLE = Role.find_by_position(3)
- manager_role = Role.find_by_position(1)
- developer_role = Role.find_by_position(2)
+ roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC')
+ manager_role = roles[0]
+ developer_role = roles[1]
+ DEFAULT_ROLE = roles.last
ROLE_MAPPING = {10 => DEFAULT_ROLE, # viewer
25 => DEFAULT_ROLE, # reporter
40 => DEFAULT_ROLE, # updater
@@ -268,6 +269,9 @@ task :migrate_from_mantis => :environment do p.identifier = project.identifier
next unless p.save
projects_map[project.id] = p.id
+ p.enabled_module_names = ['issue_tracking', 'news', 'wiki']
+ p.trackers << TRACKER_BUG
+ p.trackers << TRACKER_FEATURE
print '.'
# Project members
diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake index 6467a5430..429b39623 100644 --- a/lib/tasks/migrate_from_trac.rake +++ b/lib/tasks/migrate_from_trac.rake @@ -54,10 +54,11 @@ namespace :redmine do 'task' => TRACKER_FEATURE, 'patch' =>TRACKER_FEATURE } - - DEFAULT_ROLE = Role.find_by_position(3) - manager_role = Role.find_by_position(1) - developer_role = Role.find_by_position(2) + + roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC') + manager_role = roles[0] + developer_role = roles[1] + DEFAULT_ROLE = roles.last ROLE_MAPPING = {'admin' => manager_role, 'developer' => developer_role } @@ -173,7 +174,7 @@ namespace :redmine do elsif TracPermission.find_by_username_and_action(username, 'developer') role = ROLE_MAPPING['developer'] end - Member.create(:user => u, :project => @target_project, :role => DEFAULT_ROLE) + Member.create(:user => u, :project => @target_project, :role => role) u.reload end u diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 4ed7931f6..5e3673a4e 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -46,4 +46,9 @@ class SearchControllerTest < Test::Unit::TestCase assert_response :success assert_template 'index' end + + def test_tokens_with_quotes + get :index, :id => 1, :q => '"good bye" hello "bye bye"' + assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens) + end end |