Feature #17840 » 17840_notified_events_target_version.patch
app/models/journal.rb | ||
---|---|---|
308 | 308 |
(Setting.notified_events.include?('issue_note_added') && notes.present?) || |
309 | 309 |
(Setting.notified_events.include?('issue_status_updated') && new_status.present?) || |
310 | 310 |
(Setting.notified_events.include?('issue_assigned_to_updated') && detail_for_attribute('assigned_to_id').present?) || |
311 |
(Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?) |
|
311 |
(Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?) || |
|
312 |
(Setting.notified_events.include?('issue_fixed_version_updated') && detail_for_attribute('fixed_version_id').present?) |
|
312 | 313 |
) |
313 | 314 |
Mailer.deliver_issue_edit(self) |
314 | 315 |
end |
config/locales/en.yml | ||
---|---|---|
588 | 588 |
label_issue_status_updated: Status updated |
589 | 589 |
label_issue_assigned_to_updated: Assignee updated |
590 | 590 |
label_issue_priority_updated: Priority updated |
591 |
label_issue_fixed_version_updated: Target version updated |
|
591 | 592 |
label_document: Document |
592 | 593 |
label_document_new: New document |
593 | 594 |
label_document_plural: Documents |
lib/redmine/notifiable.rb | ||
---|---|---|
16 | 16 |
notifications << Notifiable.new('issue_status_updated', 'issue_updated') |
17 | 17 |
notifications << Notifiable.new('issue_assigned_to_updated', 'issue_updated') |
18 | 18 |
notifications << Notifiable.new('issue_priority_updated', 'issue_updated') |
19 |
notifications << Notifiable.new('issue_fixed_version_updated', 'issue_updated') |
|
19 | 20 |
notifications << Notifiable.new('news_added') |
20 | 21 |
notifications << Notifiable.new('news_comment_added') |
21 | 22 |
notifications << Notifiable.new('document_added') |
test/unit/journal_observer_test.rb | ||
---|---|---|
22 | 22 |
class JournalObserverTest < ActiveSupport::TestCase |
23 | 23 |
fixtures :issues, :issue_statuses, :journals, :journal_details, :projects, |
24 | 24 |
:projects_trackers, :trackers, :enabled_modules, :enumerations, |
25 |
:users, :email_addresses, :roles, :members, :member_roles |
|
25 |
:users, :user_preferences, :email_addresses, :roles, :members, :member_roles, |
|
26 |
:versions |
|
26 | 27 | |
27 | 28 |
def setup |
28 | 29 |
User.current = nil |
29 | 30 |
ActionMailer::Base.deliveries.clear |
30 |
@journal = Journal.find 1 |
|
31 | 31 |
end |
32 | 32 | |
33 | 33 |
# context: issue_updated notified_events |
... | ... | |
174 | 174 |
end |
175 | 175 |
assert_equal 0, ActionMailer::Base.deliveries.size |
176 | 176 |
end |
177 | ||
178 |
def test_create_should_send_email_notification_with_issue_fixed_version_updated |
|
179 |
with_settings :notified_events => %w(issue_fixed_version_updated) do |
|
180 |
user = User.find_by_login('jsmith') |
|
181 |
issue = issues(:issues_001) |
|
182 |
issue.init_journal(user) |
|
183 |
issue.fixed_version = versions(:versions_003) |
|
184 | ||
185 |
assert issue.save |
|
186 |
assert_equal 2, ActionMailer::Base.deliveries.size |
|
187 |
end |
|
188 |
end |
|
189 | ||
190 |
def test_create_should_send_email_notification_without_issue_fixed_version_updated |
|
191 |
with_settings :notified_events => [] do |
|
192 |
user = User.find_by_login('jsmith') |
|
193 |
issue = issues(:issues_001) |
|
194 |
issue.init_journal(user) |
|
195 |
issue.fixed_version = versions(:versions_003) |
|
196 | ||
197 |
assert issue.save |
|
198 |
assert_equal 0, ActionMailer::Base.deliveries.size |
|
199 |
end |
|
200 |
end |
|
177 | 201 |
end |