Issues can be unassigned now

This commit is contained in:
randx 2012-06-26 21:47:25 +03:00
parent 6abc649590
commit 88c625e3f7
8 changed files with 29 additions and 17 deletions

View file

@ -2,7 +2,9 @@ class IssueObserver < ActiveRecord::Observer
cattr_accessor :current_user
def after_create(issue)
Notify.new_issue_email(issue.id).deliver if issue.assignee != current_user
if issue.assignee && issue.assignee != current_user
Notify.new_issue_email(issue.id).deliver
end
end
def after_update(issue)
@ -14,7 +16,7 @@ class IssueObserver < ActiveRecord::Observer
protected
def send_reassigned_email(issue)
recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id != current_user.id }
recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id }
recipient_ids.each do |recipient_id|
Notify.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was).deliver