Index: app/models/import.rb =================================================================== --- app/models/import.rb (リビジョン 18147) +++ app/models/import.rb (作業コピー) @@ -80,7 +80,8 @@ 'separator' => separator, 'wrapper' => wrapper, 'encoding' => encoding, - 'date_format' => date_format + 'date_format' => date_format, + 'notifications' => '0' ) end Index: app/models/issue_import.rb =================================================================== --- app/models/issue_import.rb (リビジョン 18147) +++ app/models/issue_import.rb (作業コピー) @@ -86,7 +86,7 @@ def build_object(row, item) issue = Issue.new issue.author = user - issue.notify = false + issue.notify = !!ActiveRecord::Type::Boolean.new.cast(settings['notifications']) tracker_id = nil if tracker Index: app/views/imports/settings.html.erb =================================================================== --- app/views/imports/settings.html.erb (リビジョン 18147) +++ app/views/imports/settings.html.erb (作業コピー) @@ -21,6 +21,12 @@ <%= select_tag 'import_settings[date_format]', options_for_select(date_format_options, @import.settings['date_format']) %>

+
+

+ + <%= hidden_field_tag 'import_settings[notifications]', '0', :id => nil %> + <%= check_box_tag 'import_settings[notifications]', '1', "#{@import.settings['notifications']}" == '1' %> +

<%= submit_tag l(:label_next).html_safe + " »".html_safe, :name => nil %>

<% end %> Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (リビジョン 18147) +++ config/locales/en.yml (作業コピー) @@ -950,6 +950,7 @@ label_profile: Profile label_subtask_plural: Subtasks label_project_copy_notifications: Send email notifications during the project copy + label_import_notifications: Send email notifications during the import label_principal_search: "Search for user or group:" label_user_search: "Search for user:" label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author Index: test/functional/imports_controller_test.rb =================================================================== --- test/functional/imports_controller_test.rb (リビジョン 18148) +++ test/functional/imports_controller_test.rb (作業コピー) @@ -237,6 +237,44 @@ assert_equal ["Child of existing issue", "Child 1", "First"], issues.map(&:subject) end + def test_post_run_with_notifications + import = generate_import + + post :settings, :params => { + :id => import, + :import_settings => { + :separator => ';', + :wrapper => '"', + :encoding => 'ISO-8859-1', + :notifications => '1', + :mapping => { + :project_id => '1', + :tracker => '13', + :subject => '1', + :assigned_to => '11', + }, + }, + } + + ActionMailer::Base.deliveries.clear + assert_difference 'Issue.count', 3 do + post :run, :params => { + :id => import, + } + assert_response :found + end + actual_countof_mail = ActionMailer::Base.deliveries.size + assert_not_equal 0, actual_countof_mail + + import.reload + issue_ids = import.items.collect(&:obj_id) + expect_countof_user = + Issue.where(:id => issue_ids).inject(0) do |_, issue| + _ + (issue.notified_users | issue.notified_watchers).size + end + assert_equal expect_countof_user, actual_countof_mail + end + def test_show_without_errors import = generate_import_with_mapping import.run