From bc060b31ae086db5a6baf6e3a892c525b2b6f0cd Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 2 Dec 2007 13:52:16 +0000 Subject: [PATCH] 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 --- app/controllers/admin_controller.rb | 5 +++-- app/models/mailer.rb | 17 +++++++++++++---- app/views/admin/mail_options.rhtml | 13 +++++++++++-- app/views/settings/edit.rhtml | 7 +------ config/settings.yml | 2 ++ lang/bg.yml | 1 + lang/cs.yml | 1 + lang/de.yml | 1 + lang/en.yml | 1 + lang/es.yml | 1 + lang/fr.yml | 1 + lang/he.yml | 1 + lang/it.yml | 1 + lang/ja.yml | 1 + lang/ko.yml | 1 + lang/nl.yml | 1 + lang/pl.yml | 1 + lang/pt-br.yml | 1 + lang/pt.yml | 1 + lang/ro.yml | 1 + lang/ru.yml | 1 + lang/sr.yml | 1 + lang/sv.yml | 1 + lang/zh.yml | 1 + public/stylesheets/application.css | 4 ++-- 25 files changed, 51 insertions(+), 16 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index b448affc..58d6115e 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index fe432e9a..9639e1a9 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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 diff --git a/app/views/admin/mail_options.rhtml b/app/views/admin/mail_options.rhtml index 3c95ebd7..997cc3b2 100644 --- a/app/views/admin/mail_options.rhtml +++ b/app/views/admin/mail_options.rhtml @@ -6,16 +6,25 @@ <% form_tag({:action => 'mail_options'}, :id => 'mail-options-form') do %> +
<%=l(:label_settings)%> +

+<%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %>

+ +

+<%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %> +<%= hidden_field_tag 'settings[bcc_recipients]', 0 %>

+
+
<%=l(:text_select_mail_notifications)%> <% @notifiables.each do |notifiable| %> -
<%= l(:setting_emails_footer) %> -<%= 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 %>
<%= submit_tag l(:button_save) %> diff --git a/app/views/settings/edit.rhtml b/app/views/settings/edit.rhtml index 9b4cc2d5..4a0a400a 100644 --- a/app/views/settings/edit.rhtml +++ b/app/views/settings/edit.rhtml @@ -1,8 +1,7 @@

<%= l(:label_settings) %>

-
<% form_tag({:action => 'edit'}) do %> -
+

<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %>

@@ -34,9 +33,6 @@

<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %>

-

-<%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %>

-

<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %>

@@ -101,5 +97,4 @@ <%= submit_tag l(:button_save) %> -
<% end %> diff --git a/config/settings.yml b/config/settings.yml index e9b9eebf..9f6671f0 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -39,6 +39,8 @@ issues_export_limit: default: 500 mail_from: default: redmine@somenet.foo +bcc_recipients: + default: 1 text_formatting: default: textile wiki_compression: diff --git a/lang/bg.yml b/lang/bg.yml index 5ec4577d..6f5f527c 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/cs.yml b/lang/cs.yml index 09394ef7..1bc80c9d 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/de.yml b/lang/de.yml index 1fc6f6b6..b2612926 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -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." field_time_zone: Zeitzone text_caracters_minimum: Muss mindestens %d Zeichen lang sein. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/en.yml b/lang/en.yml index 201ba160..fb99bbb8 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -180,6 +180,7 @@ setting_self_registration: Self-registration setting_attachment_max_size: Attachment max. size setting_issues_export_limit: Issues export limit setting_mail_from: Emission email address +setting_bcc_recipients: Blind carbon copy recipients (bcc) setting_host_name: Host name setting_text_formatting: Text formatting setting_wiki_compression: Wiki history compression diff --git a/lang/es.yml b/lang/es.yml index b10bbd92..1b5638eb 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -549,3 +549,4 @@ label_registration_automatic_activation: activación automática 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" setting_time_format: Formato de hora +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/fr.yml b/lang/fr.yml index e319db81..b2466f1e 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -180,6 +180,7 @@ setting_self_registration: Inscription des nouveaux utilisateurs setting_attachment_max_size: Taille max des fichiers setting_issues_export_limit: Limite export demandes setting_mail_from: Adresse d'émission +setting_bcc_recipients: Destinataires en copie cachée (cci) setting_host_name: Nom d'hôte setting_text_formatting: Formatage du texte setting_wiki_compression: Compression historique wiki diff --git a/lang/he.yml b/lang/he.yml index 7b20240a..0f75a6ec 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/it.yml b/lang/it.yml index ceb3102a..a3a858ce 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/ja.yml b/lang/ja.yml index a1a0d968..2233c2a3 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/ko.yml b/lang/ko.yml index 9dd8951f..8962d8cd 100644 --- a/lang/ko.yml +++ b/lang/ko.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/nl.yml b/lang/nl.yml index 16686d75..ca6ad66f 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/pl.yml b/lang/pl.yml index cf549489..f478df8f 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manualna aktywacja kont notice_account_pending: "Twoje konto zostało utworzone i oczekuje na zatwierdzenie administratora." field_time_zone: Strefa czasowa text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/pt-br.yml b/lang/pt-br.yml index 9e7bd9b4..df893ff6 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/pt.yml b/lang/pt.yml index 78d739b8..1a499a2c 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/ro.yml b/lang/ro.yml index a81f61ae..a57330cc 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/ru.yml b/lang/ru.yml index 30ab5ddd..2f73a43b 100644 --- a/lang/ru.yml +++ b/lang/ru.yml @@ -546,3 +546,4 @@ label_registration_manual_activation: активировать аккаунты notice_account_pending: "Ваш аккаунт уже создан и ожидает подтверждения администратора." field_time_zone: Часовой пояс text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/sr.yml b/lang/sr.yml index d08d0172..49e2d5f3 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/sv.yml b/lang/sv.yml index 1b00eee1..11a8ce05 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -547,3 +547,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/lang/zh.yml b/lang/zh.yml index b20dd1b7..48176ceb 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -549,3 +549,4 @@ label_registration_manual_activation: manual account activation notice_account_pending: "Your account was created and is now pending administrator approval." field_time_zone: Time zone text_caracters_minimum: Must be at least %d characters long. +setting_bcc_recipients: Blind carbon copy recipients (bcc) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index acdb40cd..1059d960 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -153,8 +153,8 @@ width: 200px; #preview fieldset {margin-top: 1em; background: url(../images/draft.png)} -#settings .tabular p{ padding-left: 300px; } -#settings .tabular label{ margin-left: -300px; width: 295px; } +.tabular.settings p{ padding-left: 300px; } +.tabular.settings label{ margin-left: -300px; width: 295px; } .required {color: #bb0000;} .summary {font-style: italic;}