Feature #40569 » feature-40569.patch
| app/models/journal.rb | ||
|---|---|---|
| 354 | 354 |
(Setting.notified_events.include?('issue_status_updated') && new_status.present?) ||
|
| 355 | 355 |
(Setting.notified_events.include?('issue_assigned_to_updated') && detail_for_attribute('assigned_to_id').present?) ||
|
| 356 | 356 |
(Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?) ||
|
| 357 |
(Setting.notified_events.include?('issue_fixed_version_updated') && detail_for_attribute('fixed_version_id').present?)
|
|
| 357 |
(Setting.notified_events.include?('issue_fixed_version_updated') && detail_for_attribute('fixed_version_id').present?) ||
|
|
| 358 |
(Setting.notified_events.include?('issue_attachment_added') && details.any? {|d| d.property == 'attachment' && d.value })
|
|
| 358 | 359 |
) |
| 359 | 360 |
Mailer.deliver_issue_edit(self) |
| 360 | 361 |
end |
| config/locales/en.yml | ||
|---|---|---|
| 629 | 629 |
label_issue_assigned_to_updated: Assignee updated |
| 630 | 630 |
label_issue_priority_updated: Priority updated |
| 631 | 631 |
label_issue_fixed_version_updated: Target version updated |
| 632 |
label_issue_attachment_added: Attachment added |
|
| 632 | 633 |
label_document: Document |
| 633 | 634 |
label_document_new: New document |
| 634 | 635 |
label_document_plural: Documents |
| lib/redmine/notifiable.rb | ||
|---|---|---|
| 34 | 34 |
notifications << Notifiable.new('issue_assigned_to_updated', 'issue_updated')
|
| 35 | 35 |
notifications << Notifiable.new('issue_priority_updated', 'issue_updated')
|
| 36 | 36 |
notifications << Notifiable.new('issue_fixed_version_updated', 'issue_updated')
|
| 37 |
notifications << Notifiable.new('issue_attachment_added', 'issue_updated')
|
|
| 37 | 38 |
notifications << Notifiable.new('news_added')
|
| 38 | 39 |
notifications << Notifiable.new('news_comment_added')
|
| 39 | 40 |
notifications << Notifiable.new('document_added')
|
| test/unit/journal_observer_test.rb | ||
|---|---|---|
| 23 | 23 |
fixtures :issues, :issue_statuses, :journals, :journal_details, :projects, |
| 24 | 24 |
:projects_trackers, :trackers, :enabled_modules, :enumerations, |
| 25 | 25 |
:users, :user_preferences, :email_addresses, :roles, :members, :member_roles, |
| 26 |
:versions, :issue_categories |
|
| 26 |
:versions, :issue_categories, :attachments
|
|
| 27 | 27 | |
| 28 | 28 |
def setup |
| 29 | 29 |
User.current = nil |
| ... | ... | |
| 198 | 198 |
assert_equal 0, ActionMailer::Base.deliveries.size |
| 199 | 199 |
end |
| 200 | 200 |
end |
| 201 | ||
| 202 |
def test_create_should_send_email_notification_with_issue_attachment_added |
|
| 203 |
set_tmp_attachments_directory |
|
| 204 |
with_settings :notified_events => %w(issue_attachment_added) do |
|
| 205 |
user = User.find_by_login('jsmith')
|
|
| 206 |
issue = issues(:issues_001) |
|
| 207 |
issue.init_journal(user) |
|
| 208 |
issue.save_attachments( |
|
| 209 |
{ 'p0' => {'file' => mock_file_with_options(:original_filename => 'upload')} }
|
|
| 210 |
) |
|
| 211 | ||
| 212 |
assert issue.save |
|
| 213 |
assert_equal 2, ActionMailer::Base.deliveries.size |
|
| 214 |
end |
|
| 215 |
end |
|
| 216 | ||
| 217 |
def test_create_should_not_send_email_notification_without_issue_attachment_added |
|
| 218 |
set_tmp_attachments_directory |
|
| 219 |
with_settings :notified_events => [] do |
|
| 220 |
user = User.find_by_login('jsmith')
|
|
| 221 |
issue = issues(:issues_001) |
|
| 222 |
issue.init_journal(user) |
|
| 223 |
issue.save_attachments( |
|
| 224 |
{ 'p0' => {'file' => mock_file_with_options(:original_filename => 'upload')} }
|
|
| 225 |
) |
|
| 226 | ||
| 227 |
assert issue.save |
|
| 228 |
assert_equal 0, ActionMailer::Base.deliveries.size |
|
| 229 |
end |
|
| 230 |
end |
|
| 201 | 231 |
end |
| test/unit/lib/redmine/notifiable_test.rb | ||
|---|---|---|
| 25 | 25 | |
| 26 | 26 |
def test_all |
| 27 | 27 |
%w(issue_added issue_updated issue_note_added issue_status_updated |
| 28 |
issue_assigned_to_updated issue_priority_updated news_added |
|
| 28 |
issue_assigned_to_updated issue_priority_updated issue_fixed_version_updated issue_attachment_added news_added
|
|
| 29 | 29 |
news_comment_added document_added file_added |
| 30 | 30 |
message_posted |
| 31 | 31 |
wiki_content_added wiki_content_updated).each do |notifiable| |
- « Previous
- 1
- 2
- Next »