Index: app/models/mailer.rb =================================================================== --- app/models/mailer.rb (revision 10796) +++ app/models/mailer.rb (working copy) @@ -48,6 +48,31 @@ :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" end + # Builds a Mail::Message object used to email recipients of the issues addressed in the chagneset. + # + # Example: + # issue_changeset(changeset, issue) => Mail::Message object + # Mailer.issue_changeset(changeset, issue).deliver => sends an email to issue recipients + def issue_changeset(changeset, issue) + redmine_headers 'Project' => issue.project.identifier, + 'Issue-Id' => issue.id, + 'Issue-Author' => issue.author.login + redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to + message_id issue + references issue + @author = changeset.user + recipients = issue.recipients + # Watchers in cc + cc = issue.watcher_recipients - recipients + s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] " + s << issue.subject + s << " - Commit By #{changeset.user} [R#{changeset.revision}]" + @issue = issue + @changeset = changeset + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) + mail(:to => recipients, :cc => cc, :subject => s) + end + # Builds a Mail::Message object used to email recipients of the edited issue. # # Example: Index: app/models/changeset.rb =================================================================== --- app/models/changeset.rb (revision 10796) +++ app/models/changeset.rb (working copy) @@ -142,6 +142,9 @@ referenced_issues.uniq! self.issues = referenced_issues unless referenced_issues.empty? + self.issues.each do |issue| + Mailer.issue_changeset(self, issue).deliver if !referenced_issues.empty? && Setting.notified_events.include?('issue_updated') + end end def short_comments Index: app/views/mailer/issue_changeset.html.erb =================================================================== --- app/views/mailer/issue_changeset.html.erb (revision 0) +++ app/views/mailer/issue_changeset.html.erb (revision 0) @@ -0,0 +1,6 @@ +<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => h(@author)) %> +
+<%= textilizable(@changeset, :comments, :only_path => false) %> + +
+<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %> Index: app/views/mailer/issue_changeset.text.erb =================================================================== --- app/views/mailer/issue_changeset.text.erb (revision 0) +++ app/views/mailer/issue_changeset.text.erb (revision 0) @@ -0,0 +1,6 @@ +<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @author) %> +---------------------------------------- +<%= textilizable(@changeset.comments) %> + +---------------------------------------- +<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %>