@@ -74,7 +74,7 class User < Principal | |||||
74 | validates_confirmation_of :password, :allow_nil => true |
|
74 | validates_confirmation_of :password, :allow_nil => true | |
75 |
|
75 | |||
76 | def before_create |
|
76 | def before_create | |
77 |
self.mail_notification = |
|
77 | self.mail_notification = Setting.default_notification_option | |
78 | true |
|
78 | true | |
79 | end |
|
79 | end | |
80 |
|
80 |
@@ -7,6 +7,9 | |||||
7 | <p><%= setting_check_box :bcc_recipients %></p> |
|
7 | <p><%= setting_check_box :bcc_recipients %></p> | |
8 |
|
8 | |||
9 | <p><%= setting_check_box :plain_text_mail %></p> |
|
9 | <p><%= setting_check_box :plain_text_mail %></p> | |
|
10 | ||||
|
11 | <p><%= setting_select(:default_notification_option, User::MAIL_NOTIFICATION_OPTIONS.collect {|o| [l(o.last), o.first.to_s]}) %></p> | |||
|
12 | ||||
10 | </div> |
|
13 | </div> | |
11 |
|
14 | |||
12 | <fieldset class="box settings" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend> |
|
15 | <fieldset class="box settings" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend> |
@@ -350,6 +350,7 en: | |||||
350 | setting_start_of_week: Start calendars on |
|
350 | setting_start_of_week: Start calendars on | |
351 | setting_rest_api_enabled: Enable REST web service |
|
351 | setting_rest_api_enabled: Enable REST web service | |
352 | setting_cache_formatted_text: Cache formatted text |
|
352 | setting_cache_formatted_text: Cache formatted text | |
|
353 | setting_default_notification_option: Default notification option | |||
353 |
|
354 | |||
354 | permission_add_project: Create project |
|
355 | permission_add_project: Create project | |
355 | permission_add_subprojects: Create subprojects |
|
356 | permission_add_subprojects: Create subprojects |
@@ -184,3 +184,5 start_of_week: | |||||
184 | default: '' |
|
184 | default: '' | |
185 | rest_api_enabled: |
|
185 | rest_api_enabled: | |
186 | default: 0 |
|
186 | default: 0 | |
|
187 | default_notification_option: | |||
|
188 | default: 'only_my_events' |
@@ -60,6 +60,18 class UserTest < ActiveSupport::TestCase | |||||
60 | user.password, user.password_confirmation = "password", "password" |
|
60 | user.password, user.password_confirmation = "password", "password" | |
61 | assert user.save |
|
61 | assert user.save | |
62 | end |
|
62 | end | |
|
63 | ||||
|
64 | context "User#before_create" do | |||
|
65 | should "set the mail_notification to the default Setting" do | |||
|
66 | @user1 = User.generate_with_protected! | |||
|
67 | assert_equal 'only_my_events', @user1.mail_notification | |||
|
68 | ||||
|
69 | with_settings :default_notification_option => 'all' do | |||
|
70 | @user2 = User.generate_with_protected! | |||
|
71 | assert_equal 'all', @user2.mail_notification | |||
|
72 | end | |||
|
73 | end | |||
|
74 | end | |||
63 |
|
75 | |||
64 | context "User.login" do |
|
76 | context "User.login" do | |
65 | should "be case-insensitive." do |
|
77 | should "be case-insensitive." do |
General Comments 0
You need to be logged in to leave comments.
Login now