diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-02 13:52:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-02 13:52:16 +0000 |
commit | bc060b31ae086db5a6baf6e3a892c525b2b6f0cd (patch) | |
tree | d416375902ae23c70055d2fcc6c6c75e5282249a /app | |
parent | aebcfb1eda843b90851e0facdc0a386bf06c5d29 (diff) | |
download | redmine-bc060b31ae086db5a6baf6e3a892c525b2b6f0cd.tar.gz redmine-bc060b31ae086db5a6baf6e3a892c525b2b6f0cd.zip |
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
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_controller.rb | 5 | ||||
-rw-r--r-- | app/models/mailer.rb | 17 | ||||
-rw-r--r-- | app/views/admin/mail_options.rhtml | 13 | ||||
-rw-r--r-- | app/views/settings/edit.rhtml | 7 |
4 files changed, 28 insertions, 14 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index b448affcc..58d6115ee 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 fe432e9a6..9639e1a9c 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 3c95ebd71..997cc3b22 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 %> +<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) %> diff --git a/app/views/settings/edit.rhtml b/app/views/settings/edit.rhtml index 9b4cc2d57..4a0a400a3 100644 --- a/app/views/settings/edit.rhtml +++ b/app/views/settings/edit.rhtml @@ -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 %> |