Email notifications are now sent as Blind carbon copy by default. This can be changed in email notifications settings (new setting added).

Emission email address setting moved to the email notifications settings view.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@944 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-12-02 13:52:16 +00:00
parent aebcfb1eda
commit bc060b31ae
25 changed files with 51 additions and 16 deletions
+3 -2
View File
@@ -48,8 +48,9 @@ class AdminController < ApplicationController
def mail_options
@notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted)
if request.post?
Setting.notified_events = (params[:notified_events] || [])
Setting.emails_footer = params[:emails_footer] if params[:emails_footer]
settings = (params[:settings] || {}).dup
settings[:notified_events] ||= []
settings.each { |name, value| Setting[name] = value }
flash[:notice] = l(:notice_successful_update)
redirect_to :controller => 'admin', :action => 'mail_options'
end
+13 -4
View File
@@ -129,11 +129,20 @@ class Mailer < ActionMailer::Base
default_url_options[:protocol] = Setting.protocol
end
# Overrides the create_mail method to remove the current user from the recipients and cc
# if he doesn't want to receive notifications about what he does
# Overrides the create_mail method
def create_mail
recipients.delete(User.current.mail) if recipients && User.current.pref[:no_self_notified]
cc.delete(User.current.mail) if cc && User.current.pref[:no_self_notified]
# Removes the current user from the recipients and cc
# if he doesn't want to receive notifications about what he does
if User.current.pref[:no_self_notified]
recipients.delete(User.current.mail) if recipients
cc.delete(User.current.mail) if cc
end
# Blind carbon copy recipients
if Setting.bcc_recipients?
bcc([recipients, cc].flatten.compact.uniq)
recipients []
cc []
end
super
end
+11 -2
View File
@@ -6,16 +6,25 @@
<% form_tag({:action => 'mail_options'}, :id => 'mail-options-form') do %>
<fieldset class="box tabular settings"><legend><%=l(:label_settings)%></legend>
<p><label><%= l(:setting_mail_from) %></label>
<%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p>
<p><label><%= l(:setting_bcc_recipients) %></label>
<%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %>
<%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p>
</fieldset>
<fieldset class="box"><legend><%=l(:text_select_mail_notifications)%></legend>
<% @notifiables.each do |notifiable| %>
<label><%= check_box_tag "notified_events[]", notifiable, Setting.notified_events.include?(notifiable) %>
<label><%= check_box_tag 'settings[notified_events][]', notifiable, Setting.notified_events.include?(notifiable) %>
<%= notifiable.humanize %></label><br />
<% end %>
<p><%= check_all_links('mail-options-form') %></p>
</fieldset>
<fieldset class="box"><legend><%= l(:setting_emails_footer) %></legend>
<%= text_area_tag 'emails_footer', Setting.emails_footer, :class => 'wiki-edit', :rows => 5 %>
<%= text_area_tag 'settings[emails_footer]', Setting.emails_footer, :class => 'wiki-edit', :rows => 5 %>
</fieldset>
<%= submit_tag l(:button_save) %>
+1 -6
View File
@@ -1,8 +1,7 @@
<h2><%= l(:label_settings) %></h2>
<div id="settings">
<% form_tag({:action => 'edit'}) do %>
<div class="box tabular">
<div class="box tabular settings">
<p><label><%= l(:setting_app_title) %></label>
<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p>
@@ -34,9 +33,6 @@
<p><label><%= l(:setting_cross_project_issue_relations) %></label>
<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p>
<p><label><%= l(:setting_mail_from) %></label>
<%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p>
<p><label><%= l(:setting_host_name) %></label>
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
@@ -101,5 +97,4 @@
</fieldset>
<%= submit_tag l(:button_save) %>
</div>
<% end %>