Commit 582ed86d authored by Eric Davis's avatar Eric Davis

Add a default mail notification setting for new users

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4219 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent c059300d
...@@ -74,7 +74,7 @@ class User < Principal ...@@ -74,7 +74,7 @@ class User < Principal
validates_confirmation_of :password, :allow_nil => true validates_confirmation_of :password, :allow_nil => true
def before_create def before_create
self.mail_notification = 'only_my_events' self.mail_notification = Setting.default_notification_option
true true
end end
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
<p><%= setting_check_box :bcc_recipients %></p> <p><%= setting_check_box :bcc_recipients %></p>
<p><%= setting_check_box :plain_text_mail %></p> <p><%= setting_check_box :plain_text_mail %></p>
<p><%= setting_select(:default_notification_option, User::MAIL_NOTIFICATION_OPTIONS.collect {|o| [l(o.last), o.first.to_s]}) %></p>
</div> </div>
<fieldset class="box settings" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend> <fieldset class="box settings" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
......
...@@ -350,6 +350,7 @@ en: ...@@ -350,6 +350,7 @@ en:
setting_start_of_week: Start calendars on setting_start_of_week: Start calendars on
setting_rest_api_enabled: Enable REST web service setting_rest_api_enabled: Enable REST web service
setting_cache_formatted_text: Cache formatted text setting_cache_formatted_text: Cache formatted text
setting_default_notification_option: Default notification option
permission_add_project: Create project permission_add_project: Create project
permission_add_subprojects: Create subprojects permission_add_subprojects: Create subprojects
......
...@@ -184,3 +184,5 @@ start_of_week: ...@@ -184,3 +184,5 @@ start_of_week:
default: '' default: ''
rest_api_enabled: rest_api_enabled:
default: 0 default: 0
default_notification_option:
default: 'only_my_events'
...@@ -60,6 +60,18 @@ class UserTest < ActiveSupport::TestCase ...@@ -60,6 +60,18 @@ class UserTest < ActiveSupport::TestCase
user.password, user.password_confirmation = "password", "password" user.password, user.password_confirmation = "password", "password"
assert user.save assert user.save
end end
context "User#before_create" do
should "set the mail_notification to the default Setting" do
@user1 = User.generate_with_protected!
assert_equal 'only_my_events', @user1.mail_notification
with_settings :default_notification_option => 'all' do
@user2 = User.generate_with_protected!
assert_equal 'all', @user2.mail_notification
end
end
end
context "User.login" do context "User.login" do
should "be case-insensitive." do should "be case-insensitive." do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment