Index: test/unit/issue_test.rb =================================================================== --- test/unit/issue_test.rb (revision 3084) +++ test/unit/issue_test.rb (working copy) @@ -330,6 +330,13 @@ 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) Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 3084) +++ app/models/issue.rb (working copy) @@ -246,8 +246,8 @@ 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