after_save :after_create_from_copy
after_destroy :update_parent_attributes
after_create :send_notification
- # Keep it at the end of after_save callbacks
- after_save :clear_assigned_to_was
# Returns a SQL conditions string used to find all issues visible by the specified user
def self.visible_condition(user, options={})
issue = Issue.find(2)
issue.assigned_to = nil
assert_include user.mail, issue.recipients
- issue.save!
- assert !issue.recipients.include?(user.mail)
end
def test_recipients_should_not_include_users_that_cannot_view_the_issue
def test_update_should_notify_previous_assignee
ActionMailer::Base.deliveries.clear
- user = User.find(3)
- user.members.update_all ["mail_notification = ?", false]
- user.update! :mail_notification => 'only_assigned'
+ user = User.generate!(:mail_notification => 'only_assigned')
+ Issue.where(:id => 2).update_all(:assigned_to_id => user.id)
with_settings :notified_events => %w(issue_updated) do
issue = Issue.find(2)
issue.assigned_to = new_assignee
assert assignee.notify_about?(issue)
assert new_assignee.notify_about?(issue)
-
- issue.save!
- assert !assignee.notify_about?(issue)
- assert new_assignee.notify_about?(issue)
end
def test_notify_about_news