RE: email notification for every commit and https ยป commit_notification.patch
app/models/mailer.rb (working copy) | ||
---|---|---|
48 | 48 |
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" |
49 | 49 |
end |
50 | 50 | |
51 |
# Builds a Mail::Message object used to email recipients of the issues addressed in the chagneset. |
|
52 |
# |
|
53 |
# Example: |
|
54 |
# issue_changeset(changeset, issue) => Mail::Message object |
|
55 |
# Mailer.issue_changeset(changeset, issue).deliver => sends an email to issue recipients |
|
56 |
def issue_changeset(changeset, issue) |
|
57 |
redmine_headers 'Project' => issue.project.identifier, |
|
58 |
'Issue-Id' => issue.id, |
|
59 |
'Issue-Author' => issue.author.login |
|
60 |
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to |
|
61 |
message_id issue |
|
62 |
references issue |
|
63 |
@author = changeset.user |
|
64 |
recipients = issue.recipients |
|
65 |
# Watchers in cc |
|
66 |
cc = issue.watcher_recipients - recipients |
|
67 |
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] " |
|
68 |
s << issue.subject |
|
69 |
s << " - Commit By #{changeset.user} [R#{changeset.revision}]" |
|
70 |
@issue = issue |
|
71 |
@changeset = changeset |
|
72 |
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) |
|
73 |
mail(:to => recipients, :cc => cc, :subject => s) |
|
74 |
end |
|
75 |
|
|
51 | 76 |
# Builds a Mail::Message object used to email recipients of the edited issue. |
52 | 77 |
# |
53 | 78 |
# Example: |
app/models/changeset.rb (working copy) | ||
---|---|---|
142 | 142 | |
143 | 143 |
referenced_issues.uniq! |
144 | 144 |
self.issues = referenced_issues unless referenced_issues.empty? |
145 |
self.issues.each do |issue| |
|
146 |
Mailer.issue_changeset(self, issue).deliver if !referenced_issues.empty? && Setting.notified_events.include?('issue_updated') |
|
147 |
end |
|
145 | 148 |
end |
146 | 149 | |
147 | 150 |
def short_comments |
app/views/mailer/issue_changeset.html.erb (revision 0) | ||
---|---|---|
1 |
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => h(@author)) %> |
|
2 |
<hr /> |
|
3 |
<%= textilizable(@changeset, :comments, :only_path => false) %> |
|
4 | ||
5 |
<hr /> |
|
6 |
<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %> |
app/views/mailer/issue_changeset.text.erb (revision 0) | ||
---|---|---|
1 |
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @author) %> |
|
2 |
---------------------------------------- |
|
3 |
<%= textilizable(@changeset.comments) %> |
|
4 | ||
5 |
---------------------------------------- |
|
6 |
<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %> |