Feature #16098 » 16098_notified_events_relation-v4.patch
app/models/journal.rb | ||
---|---|---|
317 | 317 |
(Setting.notified_events.include?('issue_status_updated') && new_status.present?) || |
318 | 318 |
(Setting.notified_events.include?('issue_assigned_to_updated') && detail_for_attribute('assigned_to_id').present?) || |
319 | 319 |
(Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?) || |
320 |
(Setting.notified_events.include?('issue_fixed_version_updated') && detail_for_attribute('fixed_version_id').present?) |
|
320 |
(Setting.notified_events.include?('issue_fixed_version_updated') && detail_for_attribute('fixed_version_id').present?) || |
|
321 |
(Setting.notified_events.include?('issue_relation_updated') && details.any?{|detail| detail.property == 'relation'}) |
|
321 | 322 |
) |
322 | 323 |
Mailer.deliver_issue_edit(self) |
323 | 324 |
end |
config/locales/en.yml | ||
---|---|---|
590 | 590 |
label_issue_assigned_to_updated: Assignee updated |
591 | 591 |
label_issue_priority_updated: Priority updated |
592 | 592 |
label_issue_fixed_version_updated: Target version updated |
593 |
label_issue_relation_updated: Relation updated |
|
593 | 594 |
label_document: Document |
594 | 595 |
label_document_new: New document |
595 | 596 |
label_document_plural: Documents |
lib/redmine/notifiable.rb | ||
---|---|---|
17 | 17 |
notifications << Notifiable.new('issue_assigned_to_updated', 'issue_updated') |
18 | 18 |
notifications << Notifiable.new('issue_priority_updated', 'issue_updated') |
19 | 19 |
notifications << Notifiable.new('issue_fixed_version_updated', 'issue_updated') |
20 |
notifications << Notifiable.new('issue_relation_updated', 'issue_updated') |
|
20 | 21 |
notifications << Notifiable.new('news_added') |
21 | 22 |
notifications << Notifiable.new('news_comment_added') |
22 | 23 |
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 |
|
26 |
:versions, :issue_relations
|
|
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_relation_should_send_email_notification_with_issue_relation_updated |
|
203 |
with_settings :notified_events => %w(issue_relation_updated) do |
|
204 |
issue = Issue.generate! |
|
205 |
user = User.find_by_login('jsmith') |
|
206 |
relation = IssueRelation.new(:relation_type => IssueRelation::TYPE_RELATES, :issue_from_id => issue.id, :issue_to_id => 1) |
|
207 |
relation.init_journals(user) |
|
208 | ||
209 |
assert relation.save |
|
210 |
assert_equal 4, ActionMailer::Base.deliveries.size |
|
211 |
end |
|
212 |
end |
|
213 | ||
214 |
def test_create_relation_should_not_send_email_notification_without_issue_relation_updated |
|
215 |
with_settings :notified_events => [] do |
|
216 |
issue = Issue.generate! |
|
217 |
user = User.find_by_login('jsmith') |
|
218 |
relation = IssueRelation.new(:relation_type => IssueRelation::TYPE_RELATES, :issue_from_id => issue.id, :issue_to_id => 1) |
|
219 |
relation.init_journals(user) |
|
220 | ||
221 |
assert relation.save |
|
222 |
assert_equal 0, ActionMailer::Base.deliveries.size |
|
223 |
end |
|
224 |
end |
|
201 | 225 |
end |
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »