Patch #4263 ยป only_email_users_who_can_view_issue.diff
| test/unit/issue_test.rb (working copy) | ||
|---|---|---|
|
assert_nil copy.custom_value_for(2)
|
||
|
end
|
||
|
|
||
|
def test_recipients_of_emails_should_only_be_sent_to_users_that_can_view_the_issue
|
||
|
issue = Issue.find(1)
|
||
|
copy = issue.move_to(Project.find(3), Tracker.find(2), :copy => true)
|
||
|
#author is not a member of project anymore
|
||
|
assert !copy.recipients.include?(copy.author.mail)
|
||
|
end
|
||
|
|
||
|
def test_issue_destroy
|
||
|
Issue.find(1).destroy
|
||
|
assert_nil Issue.find_by_id(1)
|
||
| app/models/issue.rb (working copy) | ||
|---|---|---|
|
def recipients
|
||
|
recipients = project.recipients
|
||
|
# Author and assignee are always notified unless they have been locked
|
||
|
recipients << author.mail if author && author.active?
|
||
|
recipients << assigned_to.mail if assigned_to && assigned_to.active?
|
||
|
recipients << author.mail if author && author.active? && author.member_of?(project) && author.allowed_to?(:view_issues, project)
|
||
|
recipients << assigned_to.mail if assigned_to && assigned_to.active? && assigned_to.member_of?(project) && assigned_to.allowed_to?(:view_issues, project)
|
||
|
recipients.compact.uniq
|
||
|
end
|
||
|
|
||