diff --git a/app/models/note.rb b/app/models/note.rb index 8284da8616ff5cb40c78eca967860ff1640f00c5..0a9c65527813e4b453d8094582ce776dab35c9bb 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -68,6 +68,18 @@ class Note < ActiveRecord::Base }, without_protection: true) end + def self.create_assignee_change_note(noteable, project, author, assignee, source) + body = "_Reassigned to @#{assignee.username}_" + + create({ + noteable: noteable, + project: project, + author: author, + note: body, + system: true + }, without_protection: true) + end + # +noteable+ was referenced from +mentioner+, by including GFM in either +mentioner+'s description or an associated Note. # Create a system Note associated with +noteable+ with a GFM back-reference to +mentioner+. def self.create_cross_reference_note(noteable, mentioner, author, project) diff --git a/app/observers/issue_observer.rb b/app/observers/issue_observer.rb index b150e39e239b70503c7e3fa68e2a20a15524fc24..77a99388842341957b12d7c1777d406edbe7c152 100644 --- a/app/observers/issue_observer.rb +++ b/app/observers/issue_observer.rb @@ -18,6 +18,7 @@ class IssueObserver < BaseObserver def after_update(issue) if issue.is_being_reassigned? notification.reassigned_issue(issue, current_user) + Note.create_assignee_change_note(issue, issue.project, current_user, issue.assignee, current_commit) end issue.notice_added_references(issue.project, current_user)