Feature #22771 » 22771-another-label.diff
app/models/import.rb (作業コピー) | ||
---|---|---|
80 | 80 |
'separator' => separator, |
81 | 81 |
'wrapper' => wrapper, |
82 | 82 |
'encoding' => encoding, |
83 |
'date_format' => date_format |
|
83 |
'date_format' => date_format, |
|
84 |
'notifications' => '0' |
|
84 | 85 |
) |
85 | 86 |
end |
86 | 87 |
app/models/issue_import.rb (作業コピー) | ||
---|---|---|
86 | 86 |
def build_object(row, item) |
87 | 87 |
issue = Issue.new |
88 | 88 |
issue.author = user |
89 |
issue.notify = false
|
|
89 |
issue.notify = !!ActiveRecord::Type::Boolean.new.cast(settings['notifications'])
|
|
90 | 90 | |
91 | 91 |
tracker_id = nil |
92 | 92 |
if tracker |
app/views/imports/settings.html.erb (作業コピー) | ||
---|---|---|
21 | 21 |
<label for="import_settings_date_format"><%= l(:setting_date_format) %></label> |
22 | 22 |
<%= select_tag 'import_settings[date_format]', options_for_select(date_format_options, @import.settings['date_format']) %> |
23 | 23 |
</p> |
24 |
<br> |
|
25 |
<p> |
|
26 |
<label for="import_settings_notifications"><%= l(:label_import_notifications) %></label> |
|
27 |
<%= hidden_field_tag 'import_settings[notifications]', '0', :id => nil %> |
|
28 |
<%= check_box_tag 'import_settings[notifications]', '1', "#{@import.settings['notifications']}" == '1' %> |
|
29 |
</p> |
|
24 | 30 |
</fieldset> |
25 | 31 |
<p><%= submit_tag l(:label_next).html_safe + " »".html_safe, :name => nil %></p> |
26 | 32 |
<% end %> |
config/locales/en.yml (作業コピー) | ||
---|---|---|
950 | 950 |
label_profile: Profile |
951 | 951 |
label_subtask_plural: Subtasks |
952 | 952 |
label_project_copy_notifications: Send email notifications during the project copy |
953 |
label_import_notifications: Send email notifications during the import |
|
953 | 954 |
label_principal_search: "Search for user or group:" |
954 | 955 |
label_user_search: "Search for user:" |
955 | 956 |
label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author |
test/functional/imports_controller_test.rb (作業コピー) | ||
---|---|---|
237 | 237 |
assert_equal ["Child of existing issue", "Child 1", "First"], issues.map(&:subject) |
238 | 238 |
end |
239 | 239 | |
240 |
def test_post_run_with_notifications |
|
241 |
import = generate_import |
|
242 | ||
243 |
post :settings, :params => { |
|
244 |
:id => import, |
|
245 |
:import_settings => { |
|
246 |
:separator => ';', |
|
247 |
:wrapper => '"', |
|
248 |
:encoding => 'ISO-8859-1', |
|
249 |
:notifications => '1', |
|
250 |
:mapping => { |
|
251 |
:project_id => '1', |
|
252 |
:tracker => '13', |
|
253 |
:subject => '1', |
|
254 |
:assigned_to => '11', |
|
255 |
}, |
|
256 |
}, |
|
257 |
} |
|
258 | ||
259 |
ActionMailer::Base.deliveries.clear |
|
260 |
assert_difference 'Issue.count', 3 do |
|
261 |
post :run, :params => { |
|
262 |
:id => import, |
|
263 |
} |
|
264 |
assert_response :found |
|
265 |
end |
|
266 |
actual_countof_mail = ActionMailer::Base.deliveries.size |
|
267 |
assert_not_equal 0, actual_countof_mail |
|
268 | ||
269 |
import.reload |
|
270 |
issue_ids = import.items.collect(&:obj_id) |
|
271 |
expect_countof_user = |
|
272 |
Issue.where(:id => issue_ids).inject(0) do |_, issue| |
|
273 |
_ + (issue.notified_users | issue.notified_watchers).size |
|
274 |
end |
|
275 |
assert_equal expect_countof_user, actual_countof_mail |
|
276 |
end |
|
277 | ||
240 | 278 |
def test_show_without_errors |
241 | 279 |
import = generate_import_with_mapping |
242 | 280 |
import.run |