Browse Source

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
tags/1.1.0
Eric Davis 13 years ago
parent
commit
582ed86d82

+ 1
- 1
app/models/user.rb View File

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

+ 3
- 0
app/views/settings/_notifications.rhtml View File

<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>

+ 1
- 0
config/locales/en.yml View File

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

+ 2
- 0
config/settings.yml View File

default: '' default: ''
rest_api_enabled: rest_api_enabled:
default: 0 default: 0
default_notification_option:
default: 'only_my_events'

+ 12
- 0
test/unit/user_test.rb View File

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

Loading…
Cancel
Save