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

View File

@ -48,8 +48,9 @@ class AdminController < ApplicationController
def mail_options def mail_options
@notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted) @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted)
if request.post? if request.post?
Setting.notified_events = (params[:notified_events] || []) settings = (params[:settings] || {}).dup
Setting.emails_footer = params[:emails_footer] if params[:emails_footer] settings[:notified_events] ||= []
settings.each { |name, value| Setting[name] = value }
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to :controller => 'admin', :action => 'mail_options' redirect_to :controller => 'admin', :action => 'mail_options'
end end

View File

@ -129,11 +129,20 @@ class Mailer < ActionMailer::Base
default_url_options[:protocol] = Setting.protocol default_url_options[:protocol] = Setting.protocol
end end
# Overrides the create_mail method to remove the current user from the recipients and cc # Overrides the create_mail method
# if he doesn't want to receive notifications about what he does
def create_mail def create_mail
recipients.delete(User.current.mail) if recipients && User.current.pref[:no_self_notified] # Removes the current user from the recipients and cc
cc.delete(User.current.mail) if cc && User.current.pref[:no_self_notified] # 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 super
end end

View File

@ -6,16 +6,25 @@
<% form_tag({:action => 'mail_options'}, :id => 'mail-options-form') do %> <% 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> <fieldset class="box"><legend><%=l(:text_select_mail_notifications)%></legend>
<% @notifiables.each do |notifiable| %> <% @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 /> <%= notifiable.humanize %></label><br />
<% end %> <% end %>
<p><%= check_all_links('mail-options-form') %></p> <p><%= check_all_links('mail-options-form') %></p>
</fieldset> </fieldset>
<fieldset class="box"><legend><%= l(:setting_emails_footer) %></legend> <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> </fieldset>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>

View File

@ -1,8 +1,7 @@
<h2><%= l(:label_settings) %></h2> <h2><%= l(:label_settings) %></h2>
<div id="settings">
<% form_tag({:action => 'edit'}) do %> <% form_tag({:action => 'edit'}) do %>
<div class="box tabular"> <div class="box tabular settings">
<p><label><%= l(:setting_app_title) %></label> <p><label><%= l(:setting_app_title) %></label>
<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p> <%= 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> <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> <%= 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> <p><label><%= l(:setting_host_name) %></label>
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p> <%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
@ -101,5 +97,4 @@
</fieldset> </fieldset>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>
</div>
<% end %> <% end %>

View File

@ -39,6 +39,8 @@ issues_export_limit:
default: 500 default: 500
mail_from: mail_from:
default: redmine@somenet.foo default: redmine@somenet.foo
bcc_recipients:
default: 1
text_formatting: text_formatting:
default: textile default: textile
wiki_compression: wiki_compression:

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: Manuelle Kontoaktivierung
notice_account_pending: "Ihr Konto wurde erstellt und wartet jetzt auf die Genehmigung des Administrators." notice_account_pending: "Ihr Konto wurde erstellt und wartet jetzt auf die Genehmigung des Administrators."
field_time_zone: Zeitzone field_time_zone: Zeitzone
text_caracters_minimum: Muss mindestens %d Zeichen lang sein. text_caracters_minimum: Muss mindestens %d Zeichen lang sein.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -180,6 +180,7 @@ setting_self_registration: Self-registration
setting_attachment_max_size: Attachment max. size setting_attachment_max_size: Attachment max. size
setting_issues_export_limit: Issues export limit setting_issues_export_limit: Issues export limit
setting_mail_from: Emission email address setting_mail_from: Emission email address
setting_bcc_recipients: Blind carbon copy recipients (bcc)
setting_host_name: Host name setting_host_name: Host name
setting_text_formatting: Text formatting setting_text_formatting: Text formatting
setting_wiki_compression: Wiki history compression setting_wiki_compression: Wiki history compression

View File

@ -549,3 +549,4 @@ label_registration_automatic_activation: activación automática de cuenta
label_registration_manual_activation: activación manual de cuenta label_registration_manual_activation: activación manual de cuenta
notice_account_pending: "Su cuenta ha sido creada y está pendiende de la aprobación por parte de administrador" notice_account_pending: "Su cuenta ha sido creada y está pendiende de la aprobación por parte de administrador"
setting_time_format: Formato de hora setting_time_format: Formato de hora
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -180,6 +180,7 @@ setting_self_registration: Inscription des nouveaux utilisateurs
setting_attachment_max_size: Taille max des fichiers setting_attachment_max_size: Taille max des fichiers
setting_issues_export_limit: Limite export demandes setting_issues_export_limit: Limite export demandes
setting_mail_from: Adresse d'émission setting_mail_from: Adresse d'émission
setting_bcc_recipients: Destinataires en copie cachée (cci)
setting_host_name: Nom d'hôte setting_host_name: Nom d'hôte
setting_text_formatting: Formatage du texte setting_text_formatting: Formatage du texte
setting_wiki_compression: Compression historique wiki setting_wiki_compression: Compression historique wiki

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manualna aktywacja kont
notice_account_pending: "Twoje konto zostało utworzone i oczekuje na zatwierdzenie administratora." notice_account_pending: "Twoje konto zostało utworzone i oczekuje na zatwierdzenie administratora."
field_time_zone: Strefa czasowa field_time_zone: Strefa czasowa
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -546,3 +546,4 @@ label_registration_manual_activation: активировать аккаунты
notice_account_pending: "Ваш аккаунт уже создан и ожидает подтверждения администратора." notice_account_pending: "Ваш аккаунт уже создан и ожидает подтверждения администратора."
field_time_zone: Часовой пояс field_time_zone: Часовой пояс
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -549,3 +549,4 @@ label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval." notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long. text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)

View File

@ -153,8 +153,8 @@ width: 200px;
#preview fieldset {margin-top: 1em; background: url(../images/draft.png)} #preview fieldset {margin-top: 1em; background: url(../images/draft.png)}
#settings .tabular p{ padding-left: 300px; } .tabular.settings p{ padding-left: 300px; }
#settings .tabular label{ margin-left: -300px; width: 295px; } .tabular.settings label{ margin-left: -300px; width: 295px; }
.required {color: #bb0000;} .required {color: #bb0000;}
.summary {font-style: italic;} .summary {font-style: italic;}