Commit e56212949017f3efe47fbd59b0f2860120a41fa8
1 parent
78d88262
Exists in
master
and in
4 other branches
Added note when issue status changed (closed / reopened)
Implementation is correctly done through observer.
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
app/models/mailer_observer.rb
| ... | ... | @@ -71,5 +71,11 @@ class MailerObserver < ActiveRecord::Observer |
| 71 | 71 | end |
| 72 | 72 | end |
| 73 | 73 | |
| 74 | - end | |
| 74 | + if issue.closed_changed? | |
| 75 | + note = Note.new(:noteable => issue, :project => issue.project) | |
| 76 | + note.author = current_user | |
| 77 | + note.note = "_Status changed to #{issue.closed ? 'closed' : 'reopened'}_" | |
| 78 | + note.save() | |
| 79 | + end | |
| 80 | + end | |
| 75 | 81 | end | ... | ... |