From e56212949017f3efe47fbd59b0f2860120a41fa8 Mon Sep 17 00:00:00 2001 From: Cedric Gatay Date: Thu, 29 Dec 2011 21:50:26 +0100 Subject: [PATCH] Added note when issue status changed (closed / reopened) Implementation is correctly done through observer. --- app/models/mailer_observer.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/mailer_observer.rb b/app/models/mailer_observer.rb index 2567ccfd..f59469a1 100644 --- a/app/models/mailer_observer.rb +++ b/app/models/mailer_observer.rb @@ -71,5 +71,11 @@ class MailerObserver < ActiveRecord::Observer end end - end + if issue.closed_changed? + note = Note.new(:noteable => issue, :project => issue.project) + note.author = current_user + note.note = "_Status changed to #{issue.closed ? 'closed' : 'reopened'}_" + note.save() + end + end end